rathi Posted September 2, 2016 Share Posted September 2, 2016 Hi,I have a column header that is a part of the table element. And this table and its dataset are not a part of the main data set. I want to the column header to change dynamically based on values in the main dataset. The main dataset and sub data set return different resultsetsThe steps I followed were,1. For the dataset in main dataset, I created a variable (v1) to hold the value of a particular column. (The main dataset returns only one row)2. I create a parameter p1, in sub dataset and get it the value of variable v1. 3. Then I assign p1 to the static label of column header (of sub data set) in the "print when expression".Also, I want the same column to appear dynamically which I achieved.What I am unabe to achieve is that dynamic display of static label column header along with hide/show functionalityAny help on this would be greatly appreciatedThanks in advanceRathi Link to comment Share on other sites More sharing options...
kkriplani Posted September 2, 2016 Share Posted September 2, 2016 Hi,Try using ternary statement in the expression for that text field;$V{test} == 1 ? "Heading 1" :$V{test} == 2 ? "Heading 2" : "Heading3"Regards,KKriplani Link to comment Share on other sites More sharing options...
rathi Posted September 2, 2016 Author Share Posted September 2, 2016 Thank you for the response.I tried this by assigning that expression to a parameter. But I got a cast rfom string to map error.How do I use the main dataset variables inside the table element of sub dataset??Thanks again ! Link to comment Share on other sites More sharing options...
kkriplani Posted September 2, 2016 Share Posted September 2, 2016 Please share that error and the expression that you used. Link to comment Share on other sites More sharing options...
rathi Posted September 6, 2016 Author Share Posted September 6, 2016 Hi,The following steps were followed1. create a variable called v1_enabed (string) and v1_display(string) in the main dataset. I also assigned the required fields(from the main data set) to these variables 2. I created a parameter p1(string) in subdataset3. I use the subdataset fields for table creation. I used the table element.4. I go the table and map the parameter p1(string) to the table. And I assign the expression ($V{v1_enabled} == Character.toString('1')) ? $V{v1_display} : $V{v1_display} to itUntil here whenever I run the report, I do not get any error.5. Now, I go the table. Pick up the 5th column and assign this in the print when expression section -- $P(p1)Now, comes the error, java.lang.String cannot be cast to java.lang.BooleanHow do I solve this?Thanks in advanceRathi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now