Child pages
  • JSCalculation
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Refresh page Mar 29, 2024 08:29

Supported Clients
SmartClient WebClient NGClient

Property Summary
String code The full source code of this method (including doc and function declaration).
Number variableType Get or set the sql type of this variable.

Methods Summary
String getName() This method returns the name of the stored calculation.
UUID getUUID() Returns the UUID of the calculation.
Boolean hasFlag(flag) Check a flag of the calculation.
Boolean isStored() Returns whether this calculation is a stored one or not.

Property Details

code

The full source code of this method (including doc and function declaration).

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
calc.code = "function myCalculation() { return 123; }";

variableType

Get or set the sql type of this variable.
Type should be one of JSVariable.DATETIME, JSVariable.TEXT, JSVariable.NUMBER , JSVariable.INTEGER or JSVariable.MEDIA.

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
calc.variableType = JSVariable.DATETIME;

Methods Details

getName()

This method returns the name of the stored calculation.

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var calc = solutionModel.newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER, "db:/example_data/customers");
application.output(calc.getName());

getUUID()

Returns the UUID of the calculation.

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
application.output(calc.getUUID().toString());

hasFlag(flag)

Check a flag of the calculation.
The flags are a bit pattern consisting of 1 or more of the following bits:
 - JSColumn.UUID_COLUMN

Parameters

Number flag ;

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var datasourceNode = solutionModel.getDataSourceNode('db:/example_data/orders')
var calculation = datasourceNode.getCalculation('mycalculation')
if (calculation.hasFlag(JSColumn.UUID_COLUMN))
{
	 // calculation was typed as UUID 
}

isStored()

Returns whether this calculation is a stored one or not.

Returns

Supported Clients

SmartClient,WebClient,NGClient

Sample

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
if (calc.isStored()) application.output("The calculation is stored");
else application.output("The calculation is not stored");

  • No labels