Reg dynamic parameter Reg dynamic parameter
#1
Posted 16 July 2012 - 01:51 PM
select * FROM ASSET_REQUEST_29 UNION ALL
select * FROM ASSET_REQUEST_31 UNION ALL
select * FROM ASSET_REQUEST_32 UNION ALL
select * FROM ASSET_REQUEST_33 UNION ALL
select * FROM ASSET_REQUEST_34 UNION ALL
select * FROM ASSET_REQUEST_36
Problem here is there is possibility of that ifin future new version of the "ASSET_REQUEST" is created like "ASSET_REQUEST_37, ASSET_REQUEST_38" then my report won't be able to capture the informaiton from the same. I need to modify the report.
Please suggest me , how can I be able to achieve the approach where I can dynamically over come this issue.
Let me know if I need to provide any details further.
Thanks
AR
#3
Posted 19 July 2012 - 01:26 PM
So far I am not able to achieve the solution. Now I am trying to achieve: if I have tables a result of one dataset( ASSET_REQUEST_37, ASSET_REQUEST_38, ASSET_REQUEST_45, ASSET_REQUEST_52 etc ) how can I select the data from all the tables in a single dataset ?
Please let me know if any inputs need from me.
Thanks
Sairag
#4
Posted 20 July 2012 - 07:40 AM
Parameter Selection Screen
Select Assets:
*37
*38
39
40
41
42
43
44
*45
The ones with * are selected
Then, in the beforeOpen of the dataSet you could build your query with something like:
query = "select * from ASSET_REQUEST_" + params["myParam"][0];
i=1;
while (i < params["myParam"].length){
query = query + " UNION ALL select * from ASSET_REQUEST_" + params["myParam"][i];
i++;
}
this.queryText = query;
I didn't test this, but it'd be something like this.
If the asset tables aren't selected as a parameter, how do you know which ones you need to use? Let me know.
#5
Posted 24 July 2012 - 01:23 PM
Ans: I am hitting query on all_tables/all_views to identify the tables that will help to achieve my requirement.
Using this approach I am able to get the list of tables in one dataset. Problem here is how to union all the tables in the list is the show stopper
Please help me with your suggestions.
Thanks
AR
#6
Posted 24 July 2012 - 01:26 PM
http://www.eclipse.o...643/#msg_897643
Thanks
AR
#7
Posted 24 July 2012 - 03:55 PM
http://www.eclipse.o...607/#msg_895607
Please find the attahed qry for the dataset, that gives a static solution. Please let me know if any concerns.
Thanks
AR
#8
Posted 25 July 2012 - 08:57 AM
sairag, on 24 July 2012 - 04:23 PM, said:
Ans: I am hitting query on all_tables/all_views to identify the tables that will help to achieve my requirement.
Using this approach I am able to get the list of tables in one dataset. Problem here is how to union all the tables in the list is the show stopper
Please help me with your suggestions.
Thanks
AR
Ok, so you're returning one dataSet that has the list of tables that you want to use in your main query? Is this correct? Let me know.
#10
Posted 25 July 2012 - 11:37 AM
In your design, put a hidden text box at the top, bound to the dataSet with the list of tables you want to access. In the beforeOpen of that dataSet, put something like:
myTables = new Array();
In the onFetch of that dataSet, put something like:
myTables[myTables.length] = row["tableNameField"];
In the beforeClose, put:
reportContext.setPersistentGlobalVariable("myTables",myTables);
In the beforeOpen of your main dataSet, you should now be able to access this array of tables, like:
myTables = reportContext.getPersistentGlobalVariable("myTables");
Now, you can step through your array and build your query, with more beforeOpen script:
i=1;
query = "select * from " + myTables[0];
while (i < myTables.length){
query = query + "UNION ALL select * from " + myTables[i];
i++;
}
this.queryText = query;
Or modify your existing queryText in a similar fashion.
#15
Posted 08 August 2012 - 10:18 AM
Plz find the attached modified code.
Thanks
AR
#16
Posted 08 August 2012 - 10:18 AM
It seems we are close to the final result. I have slightly modified the script that you have provided. Problem is the code is not reading the list of tables. To verify I have modified code with default table value. It is working.
Plz find the attached modified code.
Thanks
AR
#17
Posted 08 August 2012 - 10:51 AM
#18
Posted 08 August 2012 - 01:31 PM
The following items have errors:
Chart (id = 657):
+ An exception occurred during processing. Please see the following message for details:
Failed to prepare the query execution for the data set: PCD for HUB
Cannot get the result set metadata.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1: ORA-00942: table or view does not exist
;
java.sql.SQLException: ORA-00942: table or view does not exist
Thanks
Amarnath
#20
Posted 08 August 2012 - 02:24 PM






MultiQuote






