Link to home
Start Free TrialLog in
Avatar of printmedia
printmedia

asked on

Display data in columns based on values in table in Crystal Reports

Hi all.

I'm working on a Crystal Report (14.0) the datasource is one table (myTable). The table has the following fields:

ModelNumber
ReportColumn1
ReportColumn2
ReportColumn3
ItemNumber
ProductDescription
PackagingString
UnitOfMeasure
Color
Dimensions

The report will pull the ModelNumber and only the fields (ItemNumber, ProductDescription, PackagingString, UnitOfMeasure, Color and Dimensions) that are in the ReportColumn1, ReportColumn2 and ReportColumn3 fields. So, let's say we have ModelNumber = ABC and ReportColumn1 = ProductDescription, ReportColumn2 = UnitOfMeasure, ReportColumn3 = Color, so only the data for those 3 fields will appear on the report for ModelNumber ABC.

We could have another ModelNumber = DEF have ReportColumn1 = ItemNumber, ReportColumn2 = Dimensions and ReportColumn3 is blank. So the report would only show the data for the ItemNumber and Dimensions fields for ModelNumber DEF.

Data in myTable:
ModelNumber--ReportColumn1--ReportColumn2--ReportColumn3--ItemNumber--ProductDescription--PackagingString--UnitOfMeasure--Color--Dimensions
ABC--ProductDescription--UnitOfMeasure--Color--Item1--Yellow pencil--50 pencils per box--EA--Yellow--2" x 8"
DEF--ItemNumber--Dimensions--<blank>--Item2--Red crayon--12 crayons per box--EA--Red--1" x 4"

How it should display in the report:
ABC--Yellow pencil--EA--Yellow
DEF--Item2--1" x 4"

I would also need to display the column header based on the field that appears for each column.

Any idea if this is possible in Crystal Reports?

Thank you in advance!
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of printmedia
printmedia

ASKER

Thank you for your reply.

There's a possibility that there are 50-75 fields, not just the 6 I put in my original question. Would I have to do an if-else for all of those fields?
Unfortunately yes.
I'll do some more thinking to see if there might be an easier way

mlmcc