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!

How to select a record from another table

Status
Not open for further replies.

tek12

Programmer
Nov 22, 2003
2
CA
Hi all,

I am new to Crystal report. Here is my question.

I have a report that has two tables added but there is no direct links between these two tables(table_1 and table_2). In record selection formula, search criteria is used for select records from table_1.

Most of the field objects in the report uses either database fields or formula fields that are related to table_1. Except one field (field_ex) in the report need to to pull out data from table_2.

I wrote a formula for that field like this:
if ({table_2.name}='John Doe' and {table_2.reg_date}=date(2003,11,01)) then
table_2.price
else
0

There is a record in the database matched the codition.
However I got 0s for all the rows in the report. Could you give me some hint?

Thanks very much!


 
Hi tek12,

The reason your formula isn't working is that if your formula is in the details section - it is only looking at (1) record - not all of the records in table two which is what I believe you want to happen.

Without further information about your report - I suggest you use a subreport based on table 2 - and pass the "name" value to the subreport which then can either return the price or zero.

Hope this helps you!

Cheers,

paulmarr
 
Thanks very much. By following your advice, I got that worked.


George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top