Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Load dataset in script
Ashe
Hello,
I would like to know if it is possible to load a dataset by script.
My purpose is
1) Load x times a dataset using a loop (in the script of the the scripted dataset for example)
2) In the fetch script of the dataset i fill a global variable
3) I use the global variable to fill the scripted dataset
This allows me to call x times a dataset and fill the scripted dataset with all the data queried.
I've been searching for a while but i don't find any solution I was able to run successfully.
Thanks
Find more posts tagged with
Comments
mwilliams
Are you calling this dataSet that you want to loop through x times with parameters from the result of another query? Or based on parameters input by the user or what? Can you explain more?
Based on my understanding, so far, you could do this completely with a scripted dataSet, where in the open method, you connect to your data source and loop through the query x times with your different parameters building your arrays which you will use in your fetch method to populate your dataSet.
If your values are coming from another dataSet and you just want to display all the results together. You could embed a table bound to the second dataSet into a table bound to the first dataSet and pass the outer table's values to the inner table's dataSet using dataSet parameter binding. Then, your second query would be reran for each set of values from the first dataSet and displayed in the report.
Let me know.
Ashe
hello,<br />
<br />
thanks for the answer
.<br />
<br />
I first query a database with an SQL Query to get a list of firm codes.<br />
After that for each firm code I must call a webservice which has in parameter the firmCode.<br />
<br />
I would like to load the webservice for each firm code in the open method of the scripted dataset, fill a global array with the data and then in the fetch method populate the scripted dataset with all the data queried from the webservice.<br />
The webservice datasource type has already been wrapped into a plugin, I just add it to my birt projet and use it.<br />
<br />
<br />
I think thas is what you said in your answer by I do not know how to do open and fetch a dataset by script
<br />
The only way I know to fetch is drag and drop a column onto the designer.<br />
<br />
<em class='bbc'>"...where in the open method, you connect to your data source and loop through the query x times with your different parameters building your arrays which you will use in your fetch method to populate your dataSet."</em><br />
<br />
Thanks
Ashe
Hello,
I found another way to do what i wished, the following tutorial explains it:
http://www.eclipse.org/birt/phoenix/examples/reports/birt2.1/subreport/index.php
I used a primary table in my report for which the datasource is the sql query.
I then inserted a table (nested table) in the primary table and linked the secondary dataset parameter to the value of the row in the primary table
This way if the sql query returns x rows in the primary table for each row
the second dataset is fetched using the primary table row value as dataset parameter
I then hid the whole thing and wrote the scripts i needed to aggregate the data of each secondary dataset into one dataset.
mwilliams
Yep. That was the second way I had listed above! Except for the writing the scripts to make it into one dataSet.
Glad you got it working! Let us know whenever you have questions!