If Temp
is going to hold the name of a unique folder, then you can use this code. Replace the String query =
line with:
IInfoObjects oParents = infoStore.query("select si_id from ci_infoobjects where si_kind = 'folder' and si_name = '" + temp + "'");
if(oParents.size()==0)
return; // folder name not found
IInfoObject oParent = (IInfoObject)oParents.get(0);
String query = "select SI_NAME, SI_ID from CI_INFOOBJECTS "
+ "where SI_KIND = 'Webi' and si_parentid = " + oParent.getID();
I don't see in the code where you're populating the temp
, username
, or password
variables, but I assume you just left that out of the listing intentionally. Obviously they will need to be defined.
Couple of other things I noticed in your code:
- You are purging the query in each report, but not saving the report afterwards.
- You are storing the report's SQL in an instance variable named
query
, but you also have a local variable namedquery
in thevariable
constructor. This could very likely cause a conflict if you need the SQL value for something. - You have an "empty catch" for
SDKException
. SDKExceptions can happen for all kinds of reasons, and as it is you will not know why the program failed. You should at least be printing out the exception, or just let it bubble up.