Report using relation for 3 tables using syntax SQL

Hi folks!

I’m trying to do a report using relation for 3 tables using syntax SQL. I’m using a following code:

function print()
{
var query = ‘SELECT * FROM REQUEST E
JOIN COMPANY A ON A.ID_COMPANY = E.ID_COMPANY
JOIN ITEM D ON E.ID_REQUEST = D.ID_REQUEST
JOIN PRODUCT C ON D.ID_PRODUCT = C.ID_PRODUCT
WHERE E.ID_REQUEST < ?
ORDER BY E.NUM_REQUEST;’

var args = new Array();
args[0] = 5

var dataset = databaseManager.getDataSetByQuery(‘crm_sybase’, query, args, 100);

foundset.loadRecords(dataset)
plugins.jasperPluginRMI.runReport(foundset, ‘relPedido.jrxml’ ,null, ‘view’, null);

}

But, I’m having this error:

Error evaluating expression :
Source text : $F{company_name}
Wrapped java.lang.Exception: Error evaluating expression :
Source text : $F{company_name} (C:\servoy_workspace\ExempleJasperReport\forms\requset.js#29)
at C:\servoy_workspace\ExempleJasperReport\forms\request.js:29 (print)

Tks for your help. :)

Hi denny,

normaly the evaluating error shows that the datatype is wrong. I would look for mistakes like:

  • Is in the foundset an dataprovider with the name company_name?
  • Is the datatype of the Data-Field (I think it should be string) the right one?
  • Has the generated Text-Field the right datatype? The same as the Data-Field.

Regards,

Stef

To load a foundset from a dataset, your dataset must contain the primary keys of the foundset, and the primary keys only.

Here you have a foundset full of data and you expect to load a foundset out of it.
It is not working, thus your foundset is probably null or invalid, and then Jasper cannot work with it.