OL Learn

SQL: Add more than one result to datamapper


I actually try to add more than one sql result to a detailed table.
The action step is as follows:

var connectionURL = ‘jdbc:odbc:Driver={iSeries Access ODBC Driver};System=**...;Uid=***;Pwd=***;’;

var sqlConnection = db.connect(connectionURL,"","");
var sqlQuery = “SELECT * FROM . WHERE *** = ‘xyz’”;
resultSet = sqlConnection.createStatement().executeQuery(sqlQuery);

The extraction step then looks as follows (detail.table):
let testExtract;
testExtract = resultSet.getRow() ? resultSet.getString(“WB_COLUMN”) : “”;

I know that the return of the select has more than one record, how can I add them to a detailed table?

Many thanks.


You can’t add multiple rows using a script (that feature is on our roadmap, however).
So in the meantime, you’ll have to store your rows in an array and then use a Loop step to add each element of the array to the detail table.

Thanks for your answer, is there an example how this works?