Print results of SQL query

Greetings,

The following problem:

After creating Select Adapter Service which returns results of the structure:

mySelectOutput=>

[INDENT]results=>

[INDENT]results[0]=>customer_id;

results[99]=>customer_id;

[/INDENT][/INDENT]this Service is invoked by:
IData result = Service.doInvoke(“folders”, “mySelect”,params);

And trying to retrieve the query data:

IDataCursor resultCursor = result.getCursor();
resultCursor.last();
numRows = IDataUtil.getIData(resultCursor);

IDataCursor numRowsCursor = numRows.getCursor();             
numRowsCursor.first();
numRows1 = IDataUtil.getIData(numRowsCursor,"results");

IDataCursor numRows1Cursor = numRows1.getCursor();
numRows1Cursor.first();

objEl = numRows1Cursor.getKey();

the objEl variable is empty. It means the actual results (result[0] etc) cannot be accessed.

Sure you know whats wrong, will you help?

Thanks in advance, psh.

P.S. Do you need the full code?

Dear psh,

Please pay attention to the following line:

numRows1 = IDataUtil.getIData(numRowsCursor,“results”);

if “results” is an Array of records, than numRows1 should be array of IData.
Change this line to the following one:

IData[] numRows1 = IDataUtil.getIDataArray(numRowsCursor,“results”);

And you’ll get result array into numRows1 variable.

Thanks,

it works!

psh.