Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting fields to be displayed in the crystal reports 2

Status
Not open for further replies.

addygoyal

Programmer
Apr 24, 2003
21
ZA
Hi Guys
I am encountering this typical requirement where in i require the fields on the report to be selected by the user for e.g. i ve these four columns
Column1 column2 column3 column4
123 456 789 987
982 234 332 356

i want user should be able to select the columns to be displayed in the report like if the user selects column1, column3 and column4 to be displayed a report like
Column1 column3 column4
123 789 987
982 332 356
to be displayed . One of the ways i ve figured out is to create 4 boolean parameters which could be entered by the user and on the basis of it i conditionally suppress the columns, but doin this leaves the empty space equivalent to the column width which is not desirable.

Hopin ya ppl turn up with something
Thanks
Addy
 
Create four string parameters named Column1, Column2, Column3, & Column4. Create a formula for each parameter named Col1, Col2, Col3, & Col4. These formulas should be like:
If {?Column1} = '' then ''
Else If {?Column1} = 'String1' then {Table.Field1}
Else If {?Column1} = 'String2' then {Table.Field2}
Else If {?Column1} = 'String3' then {Table.Field3}
Else If {?Column1} = 'String4' then {Table.Field4};

These formulas will need to be in the Details section.


 
In thread149-655589 I outlined a method for creating dynamic columns (and corresponding column headings) which is based on the same logic that GMcNamara is using, but in a little more detail.

-LB
 
You can use the logic to check for the name selected for each column as in these examples, but you may end up having some problems as you go with formatting and any totals, so design accordingly.

You can also dynamically change grouping similarly, and here's how to handle sortation:


-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top