Hello,
I’m trying to develop an application to store in database the iwebi reports information. The most important thing is to store the data providers and sql information.
I know how to get the dataproviders information, and I know to get the SQL (the code is at the end of the post). But I’ve got a big problem…how to know which dataprovider goes with which sql???. For example, if I’ve got a dataprovider which id is DP1; I need to know which one is the SQL of this DP1.
I need to link dataproviders information with SQLs information…
/*****************************************************************************/
public static Hashtable getInfoDP (IInfoObject inform) throws SDKException {
final Hashtable result = new Hashtable();
final IWebiDocDataProviders dps = ( (IWebi) inform).getDocumentDataProviders();
final int numDP = dps.count();
for (int i = 0; i < numDP; i++) {
final IWebiDocDataProvider dp = dps.item(i);
final String idSql = dp.getID();
final String nameSql = dp.getName();
final String universe = dp.getDataSourceName();
final String idUniverse = dp.getDataSourceID();
final Hashtable query = new Hashtable();
query.put(NAME_SQL,nombreSql);
query.put(ID_SQL,idSql);
query.put(NAME_UNIVERSO,universe);
query.put(ID_UNIVERSO,idUniverse);
result.put("n"+i, query);
}
return result;
}
/******************************************************/
public static Hashtable getSQLs (ReportEngine reportEngine, int docID) throws ServerException{
final Hashtable result = new QaDictionary();
final DocumentInstance document = reportEngine.openDocument(docID);
final DataProviders dp = document.getDataProviders();
final int numDP = dp.getCount();
//For every dataProvider
for (int i = 0; i < numDP; i++) {
final SQLDataProvider sqlDp = (SQLDataProvider) dp.getItem(i);
//Get sql
final SQLContainer sqlCont = sqlDp.getSQLContainer();
final SQLSelectStatement sqlStatement = (SQLSelectStatement) sqlCont.getChildAt(0);
final String sql = sqlStatement.getSQL();
//Store sql's
final Hashtable has = new Hashtable();
has.put(SQL_COMPLETA, sql);
result.put("n" + i, has);
}
return result;
}
Best Regards,
//Laura
LauraMR (BOB member since 2010-09-21)