Child pages
  • JSDataSourceNode

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

padding0px
width80px

...

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary

...

Table Cell (td)
JSCalculation

...

DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Enter additional information related to this 'class' inside the {div} macro with 'id=description'
Divcache
styleindexdisplay:none

...

iddescription

...

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryGet an existing calculation for the datasource node.

...

Table Cell (td)
JSCalculation[]

...

Gets all the calculations for the datasource node.

...

Table Cell (td)
String

...

Get the data source for this node.

...

Table Cell (td)
JSMethod

...

Get an existing foundset method for the datasource node.

...

Table Cell (td)
JSMethod[]

...

Gets all the foundset methods for the datasource node.

...

Table Cell (td)
JSCalculation

...

Creates a new calculation for the given code, the type will be the column where it could be build on (if name is a column name),

...

else it will default to JSVariable.

...

Table Cell (td)
JSCalculation

...

Table Cell (td)
JSMethod

...

Creates a new calculation for the given code and the type, if it builds on a column (name is a column name) then type will be ignored.

...

Creates a new foundset method with the specified code.

...

Table Cell (td)
Boolean

...

Removes the calculation specified by name.

...

Table Cell (td)
Boolean

...

id
HTML Table
Removes the foundset method specified by name.

...

servoy sDetail

function

class
Colgroup Tag
Column
padding0px
width100%
Table Row (tr)
style2100%height:30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idgetCalculation-String
Table Row (tr)
idname
Table Cell (td)
getCalculation
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSCalculation
Span
stylefont-weight: bold;
getCalculation
Span
(name)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get an existing calculation for the datasource node.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} name – The name of the calculation
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSCalculation
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
var calc2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation2() { return '20'; }");
var calc3 = solutionModel.getDataSourceNode("db:/example_data/employees").newCalculation("function myCalculation3() { return 'Hello World!'; }",	JSVariable.TEXT);

var c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
application.output("Name: " + c.getName() + ", Stored: " + c.isStored());

var allCalcs = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculations();
for (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idgetCalculations
Table Row (tr)
idname
Table Cell (td)
getCalculations
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSCalculation[]
Span
stylefont-weight: bold;
getCalculations
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets all the calculations for the datasource node.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSCalculation[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
var calc2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation2() { return '20'; }");
var calc3 = solutionModel.getDataSourceNode("db:/example_data/employees").newCalculation("function myCalculation3() { return 'Hello World!'; }",	JSVariable.TEXT);

var c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
application.output("Name: " + c.getName() + ", Stored: " + c.isStored());

var allCalcs = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculations();
for (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idgetDataSource
Table Row (tr)
idname
Table Cell (td)
getDataSource
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSource
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get the data source for this node.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String – the dataSource
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var nodeDataSource = solutionModel.getDataSourceNode("db:/example_data/customers").getDataSource();
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idgetMethod-String
Table Row (tr)
idname
Table Cell (td)
getMethod
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSMethod
Span
stylefont-weight: bold;
getMethod
Span
(name)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Get an existing foundset method for the datasource node.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{String} name – The name of the method
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSMethod
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var method = solutionModel.getDataSourceNode("db:/example_data/orders").newMethod("function doubleSize() { return 2*getSize(); }");

application.output('Doubled orders for this customer: '+customers_to_orders.doubleSize())
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idgetMethods
Table Row (tr)
idname
Table Cell (td)
getMethods
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSMethod[]
Span
stylefont-weight: bold;
getMethods
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets all the foundset methods for the datasource node.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSMethod[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var method = solutionModel.getDataSourceNode("db:/example_data/orders").newMethod("function doubleSize() { return 2*getSize(); }");

application.output('Doubled orders for this customer: '+customers_to_orders.doubleSize())
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idnewCalculation-String
Table Row (tr)
idname
Table Cell (td)
newCalculation
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSCalculation
Span
stylefont-weight: bold;
newCalculation
Span
(code)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new calculation for the given code, the type will be the column where it could be build on (if name is a column name),
else it will default to JSVariable.TEXT;
Table Row (tr)
idprs
Table Cell (td)Parameters
Div
classsIndent
{String} code – Table Row (tr)id2Methods DetailsgetCalculationname

getCalculation(name)

dessIndent
Get an existing calculation for the datasource node.
prs

Parameters

sIndentnameThe name of the calculation
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getCalculationsname

getCalculations()

dessIndent
Gets all the calculations for the datasource node.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getDataSourcename

getDataSource()

dessIndent
Get the data source for this node.
ret

Returns

sIndent the dataSource
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getMethodname

getMethod(name)

dessIndent
Get an existing foundset method for the datasource node.
prs

Parameters

sIndentnameThe name of the method
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getMethodsname

getMethods()

dessIndent
Gets all the foundset methods for the datasource node.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
newCalculationname

newCalculation(code)

dessIndent
Creates a new calculation for the given code, the type will be the column where it could be build on (if name is a column name),
else it will default to JSVariable.TEXT;
prs

Parameters

sIndentcodeThe code of the calculation, this must be a full function declaration.
ret

Table Cell (td)

Returns

divsIndentclients

classtd

Supported Clients

sIndent
JSCalculation Table Row (tr)
idsam
SpanSmartClient,WebClient,NGClientsam

Sample

Div
classsIndent
Code Block
languagejavascript

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
var calc2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation2() { return '20'; }");
var calc3 = solutionModel.getDataSourceNode("db:/example_data/employees").newCalculation("function myCalculation3() { return 'Hello World!'; }",	JSVariable.TEXT);

var c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
application.output("Name: " + c.getName() + ", Stored: " + c.isStored());

var allCalcs = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculations();
for (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idnewCalculation-String_Number
Table Row (tr)
idname
Table Cell (td)
newCalculation
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSCalculation
Span
stylefont-weight: bold;
newCalculation
sIdentjavascriptlastDetailRownewCalculationname

newCalculation(code, type)

tr

idclassdes Table Cell (td) DivsIndent
Creates a new calculation for the given code and the type, if it builds on a column (name is a column name) then type will be ignored.
Table Row (tr)idtd
prs

Parameters


Divclass

sIndent{String} code The code of the calculation, this must be a full function declaration.
{Number} type Table Row (tr)idThe type of the calculation, one of the JSVariable types.tdret

Returns

divsIndentclients

classtd

Supported Clients

sIndent
JSCalculation Table Row (tr)
idsam
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idnewMethod-String
Table Row (tr)
idname
Table Cell (td)
newMethod
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSMethod
Span
stylefont-weight: bold;
newMethod
Span
(code)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a new foundset method with the specified code.
Table Row (tr)
idprs
Table Cell (td)Parameters
Div
classsIndent
{String} code – SmartClient,WebClient,NGClientsam

Sample

Div
classsIndent
Code Block
languagejavascript

var calc = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation() { return 123; }", JSVariable.INTEGER);
var calc2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation2() { return '20'; }");
var calc3 = solutionModel.getDataSourceNode("db:/example_data/employees").newCalculation("function myCalculation3() { return 'Hello World!'; }",	JSVariable.TEXT);

var c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation");
application.output("Name: " + c.getName() + ", Stored: " + c.isStored());

var allCalcs = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculations();
for (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
Table Row (tr)idsIdentjavascriptlastDetailRownewMethodname

newMethod(code)

dessIndent
Creates a new foundset method with the specified code.
prs

Parameters

sIndentcodethe specified code for the foundset method
tdret

Returns


DivclassJSMethod

sIndent a JSMethod objectclients

Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var method = solutionModel.getDataSourceNode("db:/example_data/orders").newMethod("function doubleSize() { return 2*getSize(); }");

application.output('Doubled orders for this customer: '+customers_to_orders.doubleSize())
Table Row (tr)
classlastDetailRow
Table Cell (td) Table Body (tbody)
idremoveCalculation-String
Table Row (tr)
idname
Table Cell (td)
removeCalculation
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
removeCalculation
Span
(name)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Removes the calculation specified by name.
Table Row (tr)
idprs
Table Cell (td)Parameters
Div
classsIndent
{String} name – id

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
removeCalculationname

removeCalculation(name)

dessIndent
Removes the calculation specified by name.
prs

Parameters

sIndentnamethe name of the calculation to be removed
Table Row (tr)ret

Table Cell (td)

Returns


div

classsIndentBooleanid true if the removal was successful, false otherwiseclients

Table Row (tr)

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Table Cell (td) Table Row (tr)

classlastDetailRow
Table Cell (td) Table Body (tbody)
idremoveMethod-String
Table Row (tr)
idname
Table Cell (td)
removeMethod
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
removeMethod
Span
(name)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Removes the foundset method specified by name.
Table Row (tr)
idprs
Table Cell (td)Parameters
Div
classsIndent
{String} name –

Sample

Div
classsIndent
Code Block
languagejavascript

var calc1 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation1() { return 123; }", JSVariable.INTEGER);
var calc2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myCalculation2() { return '20'; }");

var c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation1");
application.output("Name: " + c.getName() + ", Stored: " + c.isStored());

solutionModel.getDataSourceNode("db:/example_data/customers").removeCalculation("myCalculation1");
c = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myCalculation1");
if (c != null) {
	application.output("myCalculation could not be removed.");
}

var allCalcs = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculations();
for (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
idsIdentjavascriptlastDetailRowremoveMethodname

removeMethod(name)

dessIndent
Removes the foundset method specified by name.
prs

Parameters

sIndentnamethe name of the method to be removed
Table Row (tr)ret

Table Cell (td)

Returns


div

classsIndentBoolean Table Row (tr)

classlastDetailRow
td true if the removal was successful, false otherwiseclients

Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

var method1 = solutionModel.getDataSourceNode("db:/example_data/customers").newMethod("function myFoundsetMethod1() { return 123; }");
var method2 = solutionModel.getDataSourceNode("db:/example_data/customers").newCalculation("function myFoundsetMethod2() { return '20'; }");

var m = solutionModel.getDataSourceNode("db:/example_data/customers").getMethod("myFoundsetMethod1");
application.output("Name: " + m.getName());

solutionModel.getDataSourceNode("db:/example_data/customers").removeMethod("myFoundsetMethod1");
m = solutionModel.getDataSourceNode("db:/example_data/customers").getCalculation("myFoundsetMethod1");
if (m != null) { application.output("myFoundsetMethod1 could not be removed."); }

var allMethods = solutionModel.getDataSourceNode("db:/example_data/customers").getMethod();
for (var i = 0; i < allMethods; i++)
{
	application.output(allMethods[i]);
}

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow