Hi All
I implemented the following code and it gives me an error because the dataset ist empty (error below, the poblem is the SELECT statement which doesn’t work, see red font parts):
===
TypeError: java.sql.SQLException: JZ0SB: Parameter index out of range: 2. JZ0SB: Parameter index out of range: 2. is not a function. (cambridgeExport, line 39)
=== code not working ===
…
if ( controller.getMaxRecordIndex() > 0 )
{
var args = new Array();
var count = controller.getMaxRecordIndex()
for ( var i = 1 ; i <= count ; i++ )
{
controller.setSelectedIndex(i);
args[i-1] = id;
}
}
var query =
‘SELECT ROW_NUMBER () OVER (ORDER BY name ASC), id, latitude, longitude, elevation, attributes_trimmed, SUBSTR(name,1,16), SUBSTR(remark,1,16)’ +
’ FROM waypoints’ +
’ WHERE id IN ?’ +
’ ORDER BY name’;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, maxReturnedRows);
//var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturnedRows);
var csv = dataset.getAsText(‘,’,‘\r\n’,‘’,false); // column separator ‘,’, row separator CR and LF (DOS), no value delimiter, no column names
…
But when I have i program it (for testing reasons) with only one id as a result (for loop is executed only once) and using id = ? in the WHERE clause it works. Seems to look like a problem wit the WHERE id IN ? clause. Has anyone a solution for that?
=== code working (but not useful) ===
…
if ( controller.getMaxRecordIndex() > 0 )
{
var args = new Array();
var count = controller.getMaxRecordIndex()
for ( var i = 1 ; i <= 1 ; i++ )
{
controller.setSelectedIndex(i);
args[i-1] = id;
}
}
var query =
‘SELECT ROW_NUMBER () OVER (ORDER BY name ASC), id, latitude, longitude, elevation, attributes_trimmed, SUBSTR(name,1,16), SUBSTR(remark,1,16)’ +
’ FROM waypoints’ +
’ WHERE id = ?’ +
’ ORDER BY name’;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, maxReturnedRows);
//var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturnedRows);
var csv = dataset.getAsText(‘,’,‘\r\n’,‘’,false); // column separator ‘,’, row separator CR and LF (DOS), no value delimiter, no column names
…
Best regards, Robert