Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Dumb newbie question Post Reply Post New Topic
Author Message
kneedeepinit
Newbie
Newbie
Avatar

Joined: 27 Mar 2008
Location: United States
Online Status: Offline
Posts: 3
Quote kneedeepinit Replybullet Topic: Dumb newbie question
     Posted: 27 Mar 2008 at 12:26pm
I hate asking as I know this is probably terribly simple, but I'm just not getting it, so here goes.
 
I need to print the vendor name for a list of requisitions.  However, in order to find the name, I must use two different routes, based on what type of req it is.  If its one type, the vendor# is in table1, if it's another, the vendor# is in table 2 - it won't exist in both tables. 
 
So I have linked from the req table, to table 1, to the vendor table, and also from the req table, to table 2, to the vendor table. I've tried these links separately, and I do get the data I want.  But now I need to have it give me one or the other.  I think I need a formula, but...I don't know how to construct ot or where to put it.  And do I need a variable now, for the print field?  I'm a little lost...as you can tell.  Confused
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 27 Mar 2008 at 1:10pm
It sounds like you set everything up correctly by linking the two vendor tables to the list of requisitions. I assume it's returning the correct data?

You are correct that you need a formula to display the correct vendor. field. In the Field Explorer, right-click on the Formulas node and select New. Then enter a formula name.

In the formula Workshop you'll need to enter a formula which tests the req type for a value and returns one of the two vendor fields. Here is some dummy code which you'll have to clean up with your own field names (it's easiest to double-click on the field name in the Fomula Workshop window at the top rather than typing them in and possibly making a typo).
 if {table.reqtype} = "a" then
    {VendorTable1.VendorName}
else
    {VendorTable2.VendorName}

Play around with this and see how it goes. If you're new to Crystal, you might want to consider getting my Encyclopedia book. It teaches you everything there is to know about Crystal Reports and I have tutorials through the whole book that let you practice what you learn. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.

Edited by BrianBischof - 27 Mar 2008 at 1:10pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
kneedeepinit
Newbie
Newbie
Avatar

Joined: 27 Mar 2008
Location: United States
Online Status: Offline
Posts: 3
Quote kneedeepinit Replybullet Posted: 27 Mar 2008 at 1:21pm
Thanks.  I will play around with this.  I was thinking along different lines...somehow if I got a null value in table1, then I would use the value in table2, rather than hardcode it to the req type.  Would that be possible?
IP IP Logged
kneedeepinit
Newbie
Newbie
Avatar

Joined: 27 Mar 2008
Location: United States
Online Status: Offline
Posts: 3
Quote kneedeepinit Replybullet Posted: 28 Mar 2008 at 6:28am
Okay, I did some checks on the data, and using the req_type is not going to work after all.  Apparently the vendor#, in some cases, can exist in both tables.  Grrr.....

Edited by kneedeepinit - 28 Mar 2008 at 7:14am
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