JSDO invoke method with input parameter table

Posted by mihai_neagoe on 09-Oct-2013 06:16

Does anyone has an example of invoking an OpenEdge JSDO method using a table parameter?

I am trying to do this from a javaScript component inside a Rollbase page. I get the following error when calling the invoke:

"ReferenceError: ttTable is not defined."

jsdo.InvokeMethod({filter:'abc',ttTable:{ttTable:ttTable}});

and in ABL:

METHOD PUBLIC VOID InvokeMethod(INPUT filter AS CHARACTER, INPUT TABLE ttTable)


Probably I am missing something in the table reference but I cannot spot it

All Replies

Posted by egarcia on 10-Oct-2013 16:12

Hello,

The error "ReferenceError: ttTable is not defined" happens because the 3rd reference to 'ttTable' in the call to InvokeMethod() is referrencing a JavaScript variable which appears not to be defined in your code.

You can try a call like the following:

jsdo.InvokeMethod({filter:'abc',ttTable:{ttTable:[]}});

The first reference to ttTable corresponds to the name of the parameter. The second reference corresponds to the temp-table. The value for the ttTable property in the example above is an empty array.

You can also try the following:

jsdo.InvokeMethod({filter:'abc',ttTable:{ttTable:[ {field1:"value1", field2:"value2"}, {field1:"value3", field2:"value4"} ]}});

Since you are using JavaScript for this code, you can also build the parameter using JavaScript variables.

Example:

var ttArrayData = [];

ttArrayData.push({field1:"value1", field2:"value2"});

ttArrayData.push({field1:"value3", field2:"value4"});

jsdo.InvokeMethod({filter:'abc',ttTable:{ttTable:ttArrayData}});

I hope this helps.

Posted by mihai_neagoe on 15-Oct-2013 02:18

Hi,

Thank you for the answer. Indeed this was the problem I was facing.

This thread is closed