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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Salvage bad DB by selectively display fields~

Status
Not open for further replies.

Iliemoo

Programmer
Sep 25, 2002
64
0
0
CA
Hi everyone, is there a way to selectively choose the fields to display for each record in Crystal report? I was handed this very poorly designed database that is not helpful when it comes to reporting.

The table looks something like this:

Time Equipment DetailOfA DetailOfB DetailOfC DetailOfD

time A Relevant Irrelevant Irrelevant Irrelevant
time B Irrelevant Relevant Irrelevant Irrelevant
time C Irrelevant Irrelevant Relevant Irrelevant
time D Irrelevant Irrelevant Irrelevant Relevant

The original designer probably thought it would be nice to include the details of other equipment at the time of entry for each piece of equipment.
The actual report should print in the straight forward manner of

Time Equipment Detail
time A Detail of A
time B Detail of B
time C Detail of C
time D Detail of D

So if I want any use out of this database, I will need to choose a different field to display for each record. I am having doubts about whether it is possible. Could anyone out there tell me otherwise? Thanks!
 
Use the following formula:
----------------------------
Switch
(
{Equipment} = A,{DetailOfA},
{Equipment} = B,{DetailOfB},
{Equipment} = C,{DetailOfC},
{Equipment} = D,{DetailOfD},
)
----------------------------
Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Or if your database supports it, you can let the database do this using a Case statement in a SQL Expression (Insert->Field Object->Right click SQL Expression and select New), which will prove faster:

Example:

CASE {table.Equipment}
WHEN "A" THEN {DetailOfA}
WHEN "B" THEN {DetailOfB}
WHEN "C" THEN {DetailOfC}
WHEN "D" THEN {DetailOfD}
ELSE "N/A"
END

Again, this depends upon your database and Crystal version, neither of which you shared.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top