views:

51

answers:

1

All,

Has anyone figured out how to return the sql for an object that is in Webi using the rebean api? I have got the ReportExpression of the column but, from there I am having a difficult time retrieving the SQL of the object.

Thanks

A: 

I believe you have gone to far into the structure. To get the SQL that is generated you should go through the DataProvider of the rebean. I have not attempted this to see what values I got, but looking at the API methods the getQuery().getSQL() methods of the DataProvider appear to be what you are looking for.

For better clarity:

DocumentInstance docInst; // get your DocumentInstance object via preferred route
DataProvider dp = docInst.getDataProviders().getItem(0); // retrieve the DataProvider that youw ould like the SQL for
String sql = dp.getQuery().getSQL(); // the SQL out of the DataProvider

getSQL() is depreciated so it may vanish in the next version

shrub34