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)
How to set order of column dynamically ?
vishal13
Hi,
I will be getting hashmap from java function.Whose key will be column name and value will be a number at which that coumn should be in table.
So i want to display columns on required position.
Table is already designed so dont want to create whole table dynamically.Just want to set column position.
How to achieve this ?
Find more posts tagged with
Comments
mwilliams
There may be a nicer way to do this, but here's one way to do it. In this report, I named each header label and detail row element, in the property editor. Then, in the beforeFactory script, I grab the table handle and all the cell handles and move the named elements to their new cell. Look at the order of the columns in the design, then run the report and look at the new order.
Hope this helps. This report was created in BIRT 3.7.2.
mwilliams
You could also do a simpler script, like:
myTable.shiftColumn(1,4);
This would move column 1 to be column 4. The issue here is that you now have to track which column has shifted to where. With the design above, you just move the elements from column to column, avoiding this confusion. I'll leave that up to you, though.
Good luck!
vishal13
Thanks for replying.
As I am calling java function on beforeFetch event which is returning java.util.Map.
e.g
map=obj.getColumnPos(); //--map is java.util.Map
and when I am trying
map.get(key);
Getting error like
get not found.
How to overcome this error.
mwilliams
Maybe try adding importPackage (Packages.java.util); to the top of your script method?