Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Vlookup: any formula similar to it in CR? Post Reply Post New Topic
Author Message
Aotoa
Newbie
Newbie


Joined: 13 Jan 2010
Online Status: Offline
Posts: 1
Quote Aotoa Replybullet Topic: Vlookup: any formula similar to it in CR?
     Posted: 13 Jan 2010 at 11:32am
Hi all, I am new to this forum. How's everyone doing?

I hope I am posting in the right section... anyways I want to ask if there is a formula in CR that is similar to vlookup in Excel?


sounds confusing, but it is the same as using Excel's vlookup that you search a table and find a record and return the data from the column you specify for it.
 
Here is the background of what I am trying to do:

Rather then always manually looking at the report and punch in all the calculations in a calculator, I want CR to do all the math for me.

so... the report looks like this:

---------------------
part#               Yield                QOH          Demand
001-001             1                     10               15
XXX-XXX       (Some other records)
XXX-XXXF     (Some other records)
XXX-XXXF     (Some other records)
001-001F           3                       0
----------------------

So according to this, since I need 15 001-001 and i have 10 on hand, I need to make 5. since the yield rate is 3, and to fullfill the quantity by making at least 6.

is there a way to tell crystal report that, given the part # 001-001, find 001-001F and return the yield rate?

Thanks!!



Edited by Aotoa - 13 Jan 2010 at 2:31pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Jan 2010 at 6:29am
if the part numbers are always the same, except for the 'F', use a subreport...if you are using a stored proc, you find it then and add it as a column.  You could also use a Command object and select all the parts that are like '%F' and the part w/o F and link them in the report, then you could just access the field w/o the subreport.
 
A command like this should work:
SELECT partNo, LEFT(partNo, LEN(partNo)-1) AS linkPartNo, Yield FROM tableName WHERE partNo LIKE '%F'
 
Then you can join the command to your table link the partNo from the table to the linkPartNo in the command, and your yield will be available. If you want to see the parts ending in F on the report, you will want to change the link type to either a Left or Right Outer Join...you will need to experiment as I am not sure how CR determines left and right.
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum