Home
Analytics
Dynamic Data Column Creation and Binding
Pranna
Hello Everybody,
I need help on creating dynamic data column and the binding.
I have list box as input parameter, values are Day and Month.
Based on these values, i written query, doing Group By function for Date field.
Based on the selection my query has to select the data column in the dataset and i want to drag it into report table dynamically.
Can you please provide me information reg. this.
Thanks in advance
Find more posts tagged with
Comments
mwilliams
Hi Pranna,
Are you using the parameter to change what the query brings in or does the parameter entered just determine what data out of the dataSet you want to display? Can you explain a little more of what you're looking for? Maybe include some sample data. Thanks.
Pranna
Hi williams,
Thanks for the reply..!
I have solved this problem. My question was that the parameter i selected will be used in query, like for ex, param1
select param1, sum(somefield) from *** where ***
group by param1;
I have table where i should display these two values, param1 and sum(..)
so for this i want to drag the data column in table dynamically.
My solution is:
I have created two datasets, one for Day and other for Month.
I have named the data column of param1 is equal to both of datasets.
so i can easily link these in table too...Only i can change dataset name dynamically.
mytable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("table_name");
if( params["GroupBy"].value == "Day" ){
mytable.setProperty( "dataSet", "Day DataSet" );
}
else if( params["GroupBy"].value == "Month" ){
mytable.setProperty( "dataSet", "Month DataSet" );
}
Once again thanks williams.....!
Regards,
Pranna
muskaan
Hi Pranna,
I am new to Birt and i have a similar requirement.
i need to choose the data column dynamically and then group by that column.
I read the post written by you, but how did you associate 1 parameter with 2 data sets.
Secondly where do we write the code you mentioned and how to connect it to the report.
Thanks,
Muskaan
Pranna
Hi Muskaan,
Here are the answers,
1) I gave same name for data columns in all the data sets.
2) I wrote it in initialize event of the report design.
Plz. revert me if you find any more issues. If I know means, I will try to help you.
Thanks.
Lavanya
Hi pranna,
Can u explain this below statement;
mytable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("table_name");
table_name means??? also in mytable.setProperty( "dataSet", "service" );
what is dataSet??
mwilliams
Hi Lavanya,
"table_name" is the name of the table that is tied to the dataSet that is being changed. To name your table, you'd go to the general section of the property editor for the table and enter a name in the "name" text box. Then, use the value you named your table in place of "table_name" in the code above.
In the setProperty function, "dataSet" is the name of the table property for what dataSet is being used and the second parameter passed in the function is the string name of the dataSet you want to use.
Hope this helps.