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!

Is there a lookup function in Crystal 9? 1

Status
Not open for further replies.

lewes

Technical User
Apr 7, 2008
14
GB
I have a subreport which lists a table of information:-
Jan 123
Feb 124
Mar 456
Apr 567

I then want the main report to search down the first column and pick out the corresponding figure in the second column. ie. for Feb it would return '124'. I also need it to return '0' if the month being searched for is not in the first column. I know how to get and set data from a subreport to a main report, it is the looking up bit I don't know how to do.

In Excel I would use the 'vLookUp' function, is there a similar way to do this in Crystal Reports 9?

Thanks
 
Load the info in the subreport to a shared array variable. In a main report formula (in a section BELOW the subreport section) use that array variable to lookup the value.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks IdoMillet,

I knew vaguely what an array is so I thought I would give your suggestion a try. Only to find an array can only contain 50 elements. I need to search about 3,000 records.

PBE
 
What is the source of data for the subreport? Perhaps you can simply use an SQL Expression in the main report to SELECT the correct value from that data source.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Do you have a field in the main report that matches the month field in the subreport? Or a date field that could be converted in a formula to match the subreport field? Then just link the sub to the main report on that field and in the sub, display only the value field and suppress other sub sections.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top