Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Data item binding
hseeram
Hello
I have a table with 5 columns in it. I am using the following code in the Expression builder:
switch (seq[ColIndex])
{
case "FIELD_1":
dataSetRow["FIELD_1"]
case "FIELD_2":
dataSetRow["FIELD_2"]
case "FIELD_3":
dataSetRow["FIELD_3"]
case "FIELD_4":
dataSetRow["FIELD_4"]
case "FIELD_5":
dataSetRow["FIELD_5"]
}
I have to use the same code in all other data items in the table.
I am guessing there might be a better way to code this. Any further enlightenment would be much appreciated.
Thanks
Find more posts tagged with
Comments
mwilliams
Hi hseeram,
Can you explain a little more about what you're trying to do?
hseeram
For example if I have five columns in a table Field_1 to Field5. I would like to display these fields in the order the user chosen. If user chooses to display these fields in Field_1, Field_3, Field_5, Field_2 and Field_4 then the report output should display in the same order.
I store this order into an array and on each data item I wrote switch code to compare and bind the associated dataset column to data item.
I was hoping for a better way to do this.
Thanks
mwilliams
hseeram,
You could have a blank 5 column table bound to your dataSet in your report and place the bindings in the table in your beforeFactory script of your report dynamically, based on the user's input.
hseeram
Michael,
Can you please give some sample code? Also can you please tell me how to add aggregation expression for the associated column?
I appreciate for your help,
Thanks
mwilliams
Take a look at this post from the devShare:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/1099-add-column-to-table-dynamically/#description'>add
column to table dynamically - Designs & Code - BIRT Exchange</a>