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)
Get data from dataset via function/on event?
iparker
Hello,
Is there a possibility to get data from a data-set in a function? For example if we have a dataset with the query
SELECT id, name
FROM table
Is it possible to access data from this data-source in a function which is defined in the script-part of a report?
Something like
function getTableData(look_for_name)
{
// Set look_for_name as filter of the query
// get the data
// return row id of the found dataset-row
}
I don’t know how I can get data from a data source. It seems that I can get the data-set with something like:
dataSet = reportContext.getDesignHandle().findDataSet('data_set_name’);
But how can I get data from the dataset? And how can I add a filter with the function-parameter for the dataset?
Thanks for some answers!
Best regards,
Timo
Find more posts tagged with
Comments
mwilliams
Hi Timo,
What are you trying to do that you want to access the data in this fashion?
iparker
Hello Michael,
I want such kind of function to get configuration-data for different data-fields.
I have a configuration-table (and dataset) with a simple type, key_value, output_value structure.
type key_value output_value
country de Deutschland
country at Österreich
country ch Schweiz
status 1 Checked
status 0 Unchecked
In the main-data-table are different values “encoded” – maybe a country in it’s short-form “de” or an status as an integer (1 = checked).
In the output of the report I want the “unencoded” value of the data – so my approach is to create a function to get this data by passing the value and the type as parameter.
Hope you understand what I mean…
Best regards,
Timo
iparker
Hello,
I solved the problem with a mysql-function. I call the own function directly in the main-query to get the data out of the config-param-table.
Best regards,
Timo
mwilliams
Timo,
Glad you found a solution. Sorry for the delay in response. The site was down for the upgrade for a few days. As always, let us know whenever you have questions!
kolla
<span style='font-family: Verdana'>Hi Michael,<br />
I have the similar requirements.<br />
I want to display user selected columns from a table.<br />
The headings from this column will come from another table.<br />
So I have two data sets one to get the column headings.( Based on user selection i will get short headings or long headings and </span><span style='font-family: Courier New'>onFetch </span><span style='font-family: Verdana'>event I am storing it in global variable. )<br />
One for getting the actual data.<br />
I can create the table with user selected columns with no problem.<br />
My problem is I am not able to change the column headings.<br />
I wrote the code to replace the label in</span> <span style='font-family: Courier New'>beforeRender / afterRender</span>. <span style='font-family: Verdana'>Either of them not working.<br />
Do you have any ideas?<br />
Thanks<br />
Srinivas</span>
mwilliams
Hi Srinivas,
Can you replicate what you're doing in your report with another report that uses the sample database or flat files? This way, I can see exactly what you're doing. Thanks.
Please include your BIRT version when you attach the report. Thanks!