how to display the necessary columns only in crystal report at run time

meesh9

New member
Joined
Aug 2, 2006
Messages
3
Programming Experience
Beginner
have a problem where i am required to take a decision
on runtime about the number of columns to show (mainly remove columns that are avaiable and then shift the remaining columns) ..

i can view the reports in a report viewer normally all i need is to be able to edit the columns in run time , If you are able to solve the problem can you please send me code or a reference to subject preferably in Vb.net any help whould be appreciated.
 
Last edited:
it's a long, hard, waste of time. we found it most economic to tell the user to export it to excel and delete the columns they dont need
 
Thank you..

Thank you.. but i don't think i will accept that unless it is last solution lol.. hasn't someone figured it out yet? there must be a way
 
it's perfectly possible to programmatically move the columns around on the report, but it;s such a spend of time and effort that if the users cannot accept editing it a bit themselves (i.e. it is for use in a production environment) that youre better off designing several different report files.

the other option we took with our users was "tough luck. if you want a report that shows a, c and d then youre going to have to put up with a report that shows a,b,c,d and e"..

on the other hand.. you CAN arrange your data in a fashion that is suitable for cross tabbing.. that way the data itself drives the number of report columns
 
yes that is it

that is was i want a report that shows for example a, c and d, forget moving the columns around like u said too mush trouble, hmm so cross tabbing... i'll get on researching that thanks alot
 
np, heres how you would have your crosstab data:

ROWHDR, COLHDR, VALUE
1, sales, 1000
1, costs, 2000
1, profit, -1000
2, sales, 500
2, costs, 100
2, profits, 400



the crosstab will automatically produce:

VB.NET:
Expand Collapse Copy
      COL sales, costs, profit
ROW
1       1000    2000  -1000
2       500      100   400


you can hide and show columns with a where clause. note because data may be disparate, it makes no sense to total it up so you may want to turn crosstab queries off

in your DB vendor, research how to make crosstabs
 
One option would be to pass a parameter to the report that could be used to determine weather or not a field should be suppressed on the report. A parameter called Style1 could be set to true if certain fields need to be suppressed. Or, You could have 1 true/false parameter for each field used used on the report. You could then conditionally suppress the undesired fields.
Layering two fields on top of each other and then suppressing one of the fields (the one not used) will give the impression of the fields shifting over. You can get real creative with conditional suppression of the fields.

Another option would be to have several simular reports with fields added or subtracted and just call the desired report based on user selections. Simple 'IF' statements could determine which report to use. I have used this option before, calling the reports Report1, Report2, Report3 etc.

Perhaps you could take that route, the user will never know the difference.
 
Suppressing a field isnt normally a problem, but shifting the other fields round in code, so there arent blank sections of report is perhaps the most tedious bit.
 
Back
Top