Child pages
  • JSDataSourceNode

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hiddendiv:style=display:none}
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 EXTRACTAUTO CHANGESUPDATE FROM THE PAGECONTENT ANDTHROUGH MERGETHE THEM BACK INTO SERVOY SOURCE{hiddenDOC GENERATOR{div}
{sub-sectiondiv:id=description|text=}{sub-sectiondiv}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[JSCalculation]{td}{td}[#getCalculation]\(name)
Get an existing calculation for the datasource node.{td}{tr}{tbody}{tbody}{tr}{td}[JSCalculation]\[]{td}{td}[#getCalculations]\()
Gets all the calculations for the datasource node.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getDataSource]\()
Get the data source for this node.{td}{tr}{tbody}{tbody}{tr}{td}[JSMethod]{td}{td}[#getMethod]\(name)
Get an existing foundset method for the datasource node.{td}{tr}{tbody}{tbody}{tr}{td}[JSMethod]\[]{td}{td}[#getMethods]\()
Gets all the foundset methods for the datasource node.{td}{tr}{tbody}{tbody}{tr}{td}[JSCalculation]{td}{td}[#newCalculation]\(code)
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.{td}{tr}{tbody}{tbody}{tr}{td}[JSCalculation]{td}{td}[#newCalculation]\(code, type)
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.{td}{tr}{tbody}{tbody}{tr}{td}[JSMethod]{td}{td}[#newMethod]\(code)
Creates a new foundset method with the specified code.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#removeCalculation]\(name)
Removes the calculation specified by name.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#removeMethod]\(name)
Removes the foundset method specified by name.{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=getCalculation-String|class=node}{tr:id=name}{td}h6.getCalculation{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSCalculation]{span}{span:id=iets|style=float: left; font-weight: bold;}getCalculation{span}{span:id=iets|style=float: left;}\(}\(name){span}{td}{tr}{builder-show:permission=edit}{tr:id=desprs}{td}{sub-section:getCalculation-String_des|trigger=button|text=}{sub-section}{sub-section:getCalculation-String_des|trigger=none|class=sIndent}Replace with description{sub-section*Parameters*\\{div:class=sIndent}\{[String]} name -- The name of the calculation
{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=sncret}{td}*SinceReturns*\\{sub-section:getCalculation-String_snc|trigger=button|text=}{sub-section}{sub-section:getCalculation-String_snc|trigger=none|div:class=sIndent} Replace with version info{sub-section[JSCalculation]{div}{td}{tr}{builder-show}{tr:id=prssam}{td}*ParametersSample*\\{sub-section:getCalculation-String_prs|trigger=button|text=}{sub-section}{sub-section:getCalculation-String_prs|trigger=none|class=sIndent}\{[String]} name -- The name of the calculation
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getCalculation-String_ret|trigger=button|text=}{sub-section}{sub-section:getCalculation-String_ret|trigger=none|class=sIndent}[JSCalculation]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getCalculation-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculation-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getCalculation-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculation-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getCalculation-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculation-String_sam|trigger=nonediv:class=sIndent}{code:language=javascript}
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]);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getCalculations}{tr:id=name}{td}h6.getCalculations{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSCalculation]\[]{span}{span:style=font-weight: bold;}getCalculations{span}{span}\(){span}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[JSCalculation]\[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
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]);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getCalculations|class=nodegetDataSource}{tr:id=name}{td}h6.getCalculationsgetDataSource{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSCalculation]\[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getCalculationsgetDataSource{span}{span:id=iets|style=float: left;}\(){}\(){span}{td}{tr}{builder-show:permission=edit}{tr:id=desret}{td}{sub-section:getCalculations_des|trigger=button|text=}{sub-section}{sub-section:getCalculations_des|trigger=none|class=sIndent}Replace with description{sub-section*Returns*\\{div:class=sIndent}[String] -- the dataSource{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Sincetr:id=sam}{td}*Sample*\\{sub-section:getCalculations_snc|trigger=button|text=}{sub-section}{sub-section:getCalculations_snc|trigger=none|class=sIndent} Replace with version info{sub-sectiondiv:class=sIndent}{code:language=javascript}
var nodeDataSource = solutionModel.getDataSourceNode("db:/example_data/customers").getDataSource();
{code}{div}{td}{tr}{builder-show}{builder-show:permission=edittr:class=lastDetailRow}{td}{td}{tr:id=prs}{tdtbody}*Parameters*\\{sub-section:getCalculations_prs|trigger=button|text=}{sub-section}{sub-section:getCalculations_prs|trigger=none|class=sIndent}{sub-section}{tbody:id=getMethod-String}{tr:id=name}{td}h6.getMethod{td}{tr}{builder-show}{tr:id=retsig}{td}*Returns*\\{sub-section:getCalculations_ret|trigger=button|text=}{sub-section}{sub-section:getCalculations_ret|trigger=none|class=sIndent}[JSCalculation]\[]{sub-section{span:style=margin-right: 5px;}[JSMethod]{span}{span:style=font-weight: bold;}getMethod{span}{span}\(name){span}{td}{tr}{builder-show:permission=edit}{tr:id=seeprs}{td}*Also seeParameters*\\{sub-section:getCalculations_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculations_see|trigger=none}{sub-section}div:class=sIndent}\{[String]} name -- The name of the method
{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linkret}{td}*External linksReturns*\\{sub-section:getCalculations_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculations_link|trigger=none}{sub-section}div:class=sIndent}[JSMethod]{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getCalculations_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getCalculations_sam|trigger=none}{code:language=javascript}
var calcmethod = solutionModel.getDataSourceNode("db:/example_data/customersorders").newCalculationnewMethod("function myCalculationdoubleSize() { return 1232*getSize(); }", 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]);
}
{code}{sub-section}{div}{application.output('Doubled orders for this customer: '+customers_to_orders.doubleSize())
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMethods}{tr:id=name}{td}h6.getMethods{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSMethod]\[]{span}{span:style=font-weight: bold;}getMethods{span}{span}\(){span}{td}{tr}{tr:classid=lastDetailRowret}{td}{td}{tr}{tbody}{tbody:id=getDataSource|class=node}{tr:id=name}{td}h6.getDataSource*Returns*\\{div:class=sIndent}[JSMethod]\[]{div}{td}{tr}{tr:id=sigsam}{td}*Sample*\\{spandiv:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getDataSource{span}{span:id=iets|style=float: left;}\(){spanclass=sIndent}{code:language=javascript}
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())
{code}{div}{td}{tr}{builder-showtr:permission=editclass=lastDetailRow}{td}{td}{tr:id=des}{tdtbody}{sub-section:getDataSource_des|trigger=button|text=}{sub-section}{sub-section:getDataSource_des|trigger=none|class=sIndent}Replace with description{sub-section}tbody:id=newCalculation-String}{tr:id=name}{td}h6.newCalculation{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=sncsig}{td}*Since*\\{sub-section:getDataSource_snc|trigger=button|text=}{sub-section}{sub-section:getDataSource_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit{span:style=margin-right: 5px;}[JSCalculation]{span}{span:style=font-weight: bold;}newCalculation{span}{span}\(code){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:getDataSource_prs|trigger=button|text=}{sub-section}{sub-section:getDataSource_prs|trigger=none|class=sIndent}{sub-sectiondiv:class=sIndent}\{[String]} code -- The code of the calculation, this must be a full function declaration.
{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getDataSource_ret|trigger=button|text=}{sub-section}{sub-section:getDataSource_ret|trigger=none|class=sIndent}[String] -- the dataSource{sub-sectiondiv:class=sIndent}[JSCalculation]{div}{td}{tr}{builder-show:permission=edit}{tr:id=seesam}{td}*Also seeSample*\\{sub-section:getDataSource_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getDataSource_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getDataSource_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getDataSource_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getDataSource_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getDataSource_sam|trigger=none}{code:language=javascript}
var nodeDataSourcecode:language=javascript}
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").getDataSourcegetCalculations();
{code}{sub-sectionfor (var i = 0; i < allCalcs.length; i++) {
	application.output(allCalcs[i]);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMethodnewCalculation-String|class=node_Number}{tr:id=name}{td}h6.getMethodnewCalculation{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSMethodJSCalculation]{span}{span:id=iets|style=float: left; font-weight: bold;}getMethodnewCalculation{span}{span:id=iets|style=float: left;}\(namecode, type){span}{td}{tr}{builder-show:permission=edit}{tr:id=desprs}{td}{sub-section:getMethod-String_des|trigger=button|text=}{sub-section}{sub-section:getMethod-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit*Parameters*\\{div:class=sIndent}\{[String]} code -- The code of the calculation, this must be a full function declaration.
\{[Number]} type -- The type of the calculation, one of the JSVariable types.
{div}{td}{tr}{tr:id=sncret}{td}*SinceReturns*\\{sub-section:getMethod-String_snc|trigger=button|text=}{sub-section}{sub-section:getMethod-String_snc|trigger=none|class=sIndent} Replace with version info{sub-sectiondiv:class=sIndent}[JSCalculation]{div}{td}{tr}{builder-show}{tr:id=prssam}{td}*ParametersSample*\\{sub-section:getMethod-String_prs|trigger=button|text=}{sub-section}{sub-section:getMethod-String_prs|trigger=none|class=sIndent}\{[String]} name -- The name of the method
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:getMethod-String_ret|trigger=button|text=}{sub-section}{sub-section:getMethod-String_ret|trigger=none|class=sIndent}[JSMethod]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getMethod-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethod-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getMethod-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethod-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getMethod-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethod-String_sam|trigger=none}{code:language=javascript}
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())
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMethods|class=node}{tr:id=name}{td}h6.getMethods{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSMethod]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getMethods{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:getMethods_des|trigger=button|text=}{sub-section}{sub-section:getMethods_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:getMethods_snc|trigger=button|text=}{sub-section}{sub-section:getMethods_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:getMethods_prs|trigger=button|text=}{sub-section}{sub-section:getMethods_prs|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:getMethods_ret|trigger=button|text=}{sub-section}{sub-section:getMethods_ret|trigger=none|class=sIndent}[JSMethod]\[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:getMethods_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethods_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:getMethods_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethods_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:getMethods_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:getMethods_sam|trigger=none}{code:language=javascript}
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())
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newCalculation-String|class=node}{tr:id=name}{td}h6.newCalculation{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSCalculation]{span}{span:id=iets|style=float: left; font-weight: bold;}newCalculation{span}{span:id=iets|style=float: left;}\(code){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:newCalculation-String_des|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:newCalculation-String_snc|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:newCalculation-String_prs|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_prs|trigger=none|class=sIndent}\{[String]} code -- The code of the calculation, this must be a full function declaration.
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:newCalculation-String_ret|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_ret|trigger=none|class=sIndent}[JSCalculation]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:newCalculation-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:newCalculation-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:newCalculation-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_sam|trigger=none}{code:language=javascript}
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]);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newCalculation-String_Number|class=node}{tr:id=name}{td}h6.newCalculation{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSCalculation]{span}{span:id=iets|style=float: left; font-weight: bold;}newCalculation{span}{span:id=iets|style=float: left;}\(code, type){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:newCalculation-String_Number_des|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_Number_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:newCalculation-String_Number_snc|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_Number_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:newCalculation-String_Number_prs|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_Number_prs|trigger=none|class=sIndent}\{[String]} code -- The code of the calculation, this must be a full function declaration.
\{[Number]} type -- The type of the calculation, one of the JSVariable types.
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:newCalculation-String_Number_ret|trigger=button|text=}{sub-section}{sub-section:newCalculation-String_Number_ret|trigger=none|class=sIndent}[JSCalculation]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:newCalculation-String_Number_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_Number_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:newCalculation-String_Number_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_Number_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:newCalculation-String_Number_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newCalculation-String_Number_sam|trigger=none}{code:language=javascript}
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]);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newMethod-String|class=node}{tr:id=name}{td}h6.newMethod{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSMethod]{span}{span:id=iets|style=float: left; font-weight: bold;}newMethod{span}{span:id=iets|style=float: left;}\(code){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:newMethod-String_des|trigger=button|text=}{sub-section}{sub-section:newMethod-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:newMethod-String_snc|trigger=button|text=}{sub-section}{sub-section:newMethod-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:newMethod-String_prs|trigger=button|text=}{sub-section}{sub-section:newMethod-String_prs|trigger=none|class=sIndent}\{[String]} code -- the specified code for the foundset method
{sub-section}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:newMethod-String_ret|trigger=button|text=}{sub-section}{sub-section:newMethod-String_ret|trigger=none|class=sIndent}[JSMethod] -- a JSMethod object{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:newMethod-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newMethod-String_see|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:newMethod-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newMethod-String_link|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:newMethod-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:newMethod-String_sam|trigger=none}{code:language=javascript}
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())
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeCalculation-String|class=node}{tr:id=name}{td}h6.removeCalculation{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}removeCalculation{span}{span:id=iets|style=float: left;}\(name){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:removeCalculation-String_des|trigger=button|text=}{sub-section}{sub-section:removeCalculation-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:removeCalculation-String_snc|trigger=button|text=}{sub-section}{sub-section:removeCalculation-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:removeCalculation-String_prs|trigger=button|text=}{sub-section}{sub-section:removeCalculation-String_prs|trigger=none|class=sIndent}\{[String]} name -- the name of the calculation to be removed
{sub-sectiondiv:class=sIndent}{code:language=javascript}
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]);
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=newMethod-String}{tr:id=name}{td}h6.newMethod{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[JSMethod]{span}{span:style=font-weight: bold;}newMethod{span}{span}\(code){span}{td}{tr}{tr:id=retprs}{td}*ReturnsParameters*\\{sub-section:removeCalculation-String_ret|trigger=button|text=}{sub-section}{sub-section:removeCalculation-String_ret|trigger=none|div:class=sIndent}\{[BooleanString]} code -- truethe ifspecified thecode removalfor wasthe successful,foundset falsemethod
otherwise{sub-sectiondiv}{td}{tr}{builder-show:permission=edit}{tr:id=seeret}{td}*Also seeReturns*\\{sub-section:removeCalculation-String_see|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:removeCalculation-String_see|trigger=none}{sub-section}{[JSMethod] -- a JSMethod object{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linksam}{td}*External linksSample*\\{sub-section:removeCalculation-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:removeCalculation-String_link|trigger=none}{sub-sectiondiv:class=sIndent}{code:language=javascript}
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())
{code}{div}{td}{tr}{builder-show}{tr:idclass=samlastDetailRow}{td}*Sample*\\{sub-section:removeCalculation-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:removeCalculation-String_sam|trigger=none}{code:language=javascript}
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]);
}
{code}{sub-section}{td}{tr}{tbody}{tbody:id=removeCalculation-String}{tr:id=name}{td}h6.removeCalculation{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}removeCalculation{span}{span}\(name){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- the name of the calculation to be removed
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if the removal was successful, false otherwise{div}{td}{tr}{tr:classid=lastDetailRowsam}{td}{td}{tr}{tbody}{tbody:id=removeMethod-String|class=node}{tr:id=name}{td}h6.removeMethod{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}removeMethod{span}{span:id=iets|style=float: left;}\(name){span}{td}{tr}{builder-show:permission=edit}{tr:id=des}{td}{sub-section:removeMethod-String_des|trigger=button|text=}{sub-section}{sub-section:removeMethod-String_des|trigger=none|class=sIndent}Replace with description{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=snc}{td}*Since*\\{sub-section:removeMethod-String_snc|trigger=button|text=}{sub-section}{sub-section:removeMethod-String_snc|trigger=none|class=sIndent} Replace with version info{sub-section}{td}{tr}{builder-show}{tr:id=prs}{td}*Parameters*\\{sub-section:removeMethod-String_prs|trigger=button|text=}{sub-section}{sub-section:removeMethod-String_prs|trigger=none|class=sIndent}\{[String]} name -- the name of the method to be removed
{sub-section*Sample*\\{div:class=sIndent}{code:language=javascript}
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]);
}
{code}{div}{td}{tr}{tr:id=retclass=lastDetailRow}{td}{td}*Returns*\\{sub-section:removeMethod-String_ret|trigger=button|text=}{sub-section}{sub-section:removeMethod-String_ret|trigger=none|class=sIndent}[Boolean] -- true if the removal was successful, false otherwise{sub-section}{td}{tr}{builder-show:permission=edit{tr}{tbody}{tbody:id=removeMethod-String}{tr:id=name}{td}h6.removeMethod{td}{tr}{tr:id=seesig}{td}*Also see*\\{sub-section:removeMethod-String_see|trigger=button|text=}{sub-section}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}removeMethod{span}{span}\(name){span}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}{sub-section:removeMethod-String_see|trigger=none}{sub-section}\{[String]} name -- the name of the method to be removed
{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=linkret}{td}*External linksReturns*\\{sub-section:removeMethod-String_link|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:removeMethod-String_link|trigger=none}{sub-section}{[Boolean] -- true if the removal was successful, false otherwise{div}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:removeMethod-String_sam|trigger=button|text=}{sub-section}{div:class=sIndent}{sub-section:removeMethod-String_sam|trigger=none}{code:language=javascript}
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]);
}
{code}{sub-section}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}