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

multi tables report question

Status
Not open for further replies.

Michniu

Programmer
Dec 12, 2001
3
CA
Hi,

i have to build a report like that
main table: talbe1 filed :a, b c

if table1.a=1 then get field table2.price
els if table1.a=2 then get field table3.price

hoow can i make it

thanks
 
Assumming you can link the tables, you're almost done. Write a formula that does exactly what you said:

If {table1.a}=1 then {Table2.Price} else
If {table1.a}=2 then {Table3.price}

Place this formula field on your report. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
The only problem with dgilz's solution is that you will have two records for each transaction. you will need to group on the transaction id number and supress the details section.

You could create two sub-reports and link on a formula field. Use the If..then..else logic to create two formula field like this:

//link1
If {table.field} =1 then {table.keyfield}

//link2
If {table.field} =2 then {table.keyfield}

In the sub reports (there are two of them) you simply return the price field using a shared variable.

Alternative three would be to create a crystal dictionary.
In the dictionary you can link on a formula field. create the two formulas and then link to the two price tables. Only one will be successful for each master record. Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Thanks Howard and dgillz

But I have 4 tables like below:
table1 table2 table3 table4

pmkey1 pmkey1 pmkey1 pmkey1
pmkey2 pmkey2 pmkey2 pmkey2
types price price price

now i have to make the report like this

pmke1 pmkey2 price

the condition is:
if table1.types="table2" then {table2.price} else
if table1.types="table3" then {table3.price} else
if table1.types="table4" then {table4.price}


I use dgillz 's method but get result like Howard said;

i can't build the report as Howard said, Can you guys tell me more details to build it .

thank you very much




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top