Hi all
I've just deployed Ebase 4.5.1 and ported some integration solutions across from my 4.4 environment, and an integration script which was working in the earlier version is now returning the following error:
Error evaluating expression settablerow('TBL_REQUEST_FIELDS','TBL_REQUEST_FIELDS-NAME','ALL_COUNCILLORS') = 'OK' - Can only invoke this function from an online form
I note that 4.5.1 SP20131115 contains a fix for 'Null Pointer Exception in Java functions called from a server-side Javascript script', the problem log for which (ref. 335136) specifically references the settablerow function - is there any chance that the fix has affected my use of settablerow in integration (i.e. server side) scripts?
Many thanks, Doug
settablerow function in integration script errors in v4.5.1
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 8
- Joined: Wed Jan 23, 2008 11:51 am
- Location: Perth, WA, Australia
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Doug,
You're right in your assumption - this fix seems to have caused another problem when using the functions from an integration service or workflow. We'll fix it in the next service pack. In the meantime, the only solution is to set the table row with a Javascript script then call this from FPL via callscript. Your Javascript script will look like this:
Regards
Jon
You're right in your assumption - this fix seems to have caused another problem when using the functions from an integration service or workflow. We'll fix it in the next service pack. In the meantime, the only solution is to set the table row with a Javascript script then call this from FPL via callscript. Your Javascript script will look like this:
Code: Select all
var table = tables.REQUEST_FIELDS;
var row = table.findRow(table.NAME, "ALL_COUNCILLORS");
if (row != -1)
{
table.setCurrentRow(row);
}
Jon
0 x
-
- Ebase User
- Posts: 8
- Joined: Wed Jan 23, 2008 11:51 am
- Location: Perth, WA, Australia
Hi Jon (guessing that's Jon R btw - good to speak to you again
)
Thanks for the tip. I've set up a JavaScript script as you suggest, but get the following error when it runs:
ERROR Can't find method com.ebasetech.ufs.runtime.external.api.impl.ApiTableBase.findRow(string,string). (CLRFRM_JS_SETTABLEROW#24)
The full script up to the error is below.
Cheers, Doug

Thanks for the tip. I've set up a JavaScript script as you suggest, but get the following error when it runs:
ERROR Can't find method com.ebasetech.ufs.runtime.external.api.impl.ApiTableBase.findRow(string,string). (CLRFRM_JS_SETTABLEROW#24)
The full script up to the error is below.
Cheers, Doug
Code: Select all
importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
var table ;
switch(fields.STABROW_TABLE.value){
case "TBL_REQUEST_FIELDS":
table = tables.TBL_REQUEST_FIELDS ;
break ;
//... other cases
default:
table = tables.TBL_REQUEST_FIELDS ;
break ;
}
var column = fields.STABROW_FIELDNAME.value ;
var matchValue = fields.STABROW_FIELDVALUE.value ;
var row = table.findRow(column, matchValue);
0 x
-
- Ebase User
- Posts: 8
- Joined: Wed Jan 23, 2008 11:51 am
- Location: Perth, WA, Australia
More details: wondered if the problem was in the assignment of the 'table' variable, so I've changed the code to act directly on the tables.[table name] option, but the result is the same.
Code: Select all
var row ;
var column = fields.STABROW_FIELDNAME.value ;
var matchValue = fields.STABROW_FIELDVALUE.value ;
switch(fields.STABROW_TABLE.value){
case "TBL_REQUEST_FIELDS":
row = tables.TBL_REQUEST_FIELDS.findRow(column, matchValue) ;
break ;
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Hello Doug,
the findRow() method takes a table column object as its first parameter which is the column that should be searched. So if the table TBL_REQUEST_FIELDS has a column COL1 it should be something like:
Regards
Jon
the findRow() method takes a table column object as its first parameter which is the column that should be searched. So if the table TBL_REQUEST_FIELDS has a column COL1 it should be something like:
Code: Select all
var column = tables.TBL_REQUEST_FIELDS.COL1;
tables.TBL_REQUEST_FIELDS.findRow(column, "searchValue");
Jon
0 x
-
- Ebase User
- Posts: 8
- Joined: Wed Jan 23, 2008 11:51 am
- Location: Perth, WA, Australia
Hi Jon
That is where I've been going wrong - I had 'column' as a string containing the required column name, not an object. When I explicitly set the variable to the column object the script works fine.
As you can probably guess, I'm looking for a way to make this process of looking up a row in a table (which I use ~everywhere~) generic by storing the table and column names and the value I want to match against in form fields then invoking one JS script which picks up on those values. Is it possible to substitute a value into an expression like
One possible solution I guess would be to use eval():
but everything I've read recommends strongly against using eval(), particularly in the latest version of ECMAScript.
Cheers, Doug
That is where I've been going wrong - I had 'column' as a string containing the required column name, not an object. When I explicitly set the variable to the column object the script works fine.
As you can probably guess, I'm looking for a way to make this process of looking up a row in a table (which I use ~everywhere~) generic by storing the table and column names and the value I want to match against in form fields then invoking one JS script which picks up on those values. Is it possible to substitute a value into an expression like
Code: Select all
var myTable = tables.MY_TABLE_NAME ;
Code: Select all
var myTable = eval("tables." + fields.MY_VARIABLE_TABLE_NAME.value) ;
var myColumn = eval("myTable." + fields.MY_VARIABLE_COL_NAME.value)
Cheers, Doug
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Doug,
Yes it's probably wise to treat eval with some caution, though you can use it when you can't find an alternative. In this case, you should be able to do what you want with the getTable() and getColumn() methods which take a string as argument e.g.
These getXxx() methods exist wherever you get a named element e.g. fields, controls, pages, tables, resources etc. So you should always be able to make your code generic.
Regards
Jon
Yes it's probably wise to treat eval with some caution, though you can use it when you can't find an alternative. In this case, you should be able to do what you want with the getTable() and getColumn() methods which take a string as argument e.g.
Code: Select all
function setTableRow(tableName, columnName, value)
{
var tab = tables.getTable(tableName);
if (tab)
{
var col = tab.getColumn(columnName);
if (col)
{
var row = tab.findRow(col, value);
if (row != -1)
{
tab.currentRow = row;
}
}
}
}
Regards
Jon
0 x
-
- Ebase User
- Posts: 8
- Joined: Wed Jan 23, 2008 11:51 am
- Location: Perth, WA, Australia
Who is online
Users browsing this forum: No registered users and 26 guests