Jump to content
We've recently updated our Privacy Statement, available here ×

How to remove column dynamically if column does not have any value


anand.p

Recommended Posts

Hi

I am struggling with a problem.

Actaully I have to generate a report on a condition that if any column does not have value it should totally disappear from the report .I went through the table component where 

i can see the condition in property section  "Column Print When"  but I'm unable to figure out that what condition i should use there so that it evaluate whole column to make it disappear from the report if it does not contains any value.

I need quik help in this part. Please if anyone have any idea about this part please rply

Thanks

Anand

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Hi anand.p ,

What you can do are two things , 

First which is a easier and prefered way is that , suppose a field contains a feild expression as $F{Amount} , then in the print when expression for that particular field you write the expression as $F[Amount]!=null

 

Other way is that you can see one of the property of the textfield as 'Remove line Blank ' you could check that and this will definitely solve the purpose.

 

Hope that above explanation helps

Thanks,

Ankur

Link to comment
Share on other sites

Hi Ankur

 

Thanks for you help but this was not my question exactly. This can be done at report level in properties which I'm aware of very well.

 

My question is little bit tricky. It was to disappear whole column section from the report along with column header dynamically if that column does't not contains any value. I hope I'm able to make you clear what I want to know.

 

Its like if one column does not have any value (In whole database) than it should not be included in report itself dynamically.

Link to comment
Share on other sites

Hi anand.p,

For this problem what can be done suppose a field $F{Amount} is there , so you can add a variable which counts whether or not the values are present in the particular coulmn and then this variable can be used in the Print when expression for the Column header and the column field (Print When Expression as $V{COUNT} != 0).

So in this way this is dynamically checked wether or not any value or record for a particular column is present for not, and accordingly the column disappears.

 

Above is one scenario.,

Another could be if you totally want to get it disappeared from the layout so that if a particular coulmn is absent then next colmn extends.In this case also you need to declare a a varibale which checks whether the data is present in a particular colum as done in the above scenario.

For this you will have to place overlays, suppose col1,col2,col3,col4,col5 are in the original scenario but suppose, col3 goes missing, then col4 should extend and col3 should disaapear completely.

For that you will need to place a column header and data feild too , overlapping  column header and data feild  on col3 and col4 which will contain the  Print When Expression as $V{COUNT} == 0 (This count would tell if col3 is empty and will print this larger field) [same expression will be there for larger datafield]  and the original col3 header and data field would contain $V{COUNT} != 0 for the normal scenario when the data is present in the column,

So applying this will completly dissappear the column for the layout.

I hope that this explanation helps.

 

Thanks.

Ankur Gupta

Link to comment
Share on other sites

  • 3 weeks later...

Hi Ankur,

 

I assume anand is asking about the table componenet, that is where you have the "Column print when " option.. I think your answer is for a normal layout and not using a table component!! Even I have the same query.. has anyone hidden column in a table component based on a condition using values from the Dataset  columns? This is throwing an error saying 'Field not found 'or 'parameter not found'..

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...
  • 4 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...