Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: IF formula for Crystal XI Post Reply Post New Topic
Author Message
rburke72
Newbie
Newbie
Avatar

Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Quote rburke72 Replybullet Topic: IF formula for Crystal XI
     Posted: 03 Aug 2011 at 8:18am

I need to create an IF formula for a list.  I have a list of Attributes.  If the Attribute Type is Commute Method and the Attribute Name is Bicycle, then it should have an "X".  Can someone please help created a formula with this criteria?

 
 
Racquel Burke
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 03 Aug 2011 at 8:43am
if {Attribute Type}='Commute Method' and {Attribute Name}='Bicycle' then 'X'
sharona
IP IP Logged
rburke72
Newbie
Newbie
Avatar

Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Quote rburke72 Replybullet Posted: 03 Aug 2011 at 8:50am
Thanks for the quick reply.  I keep getting an error message with that formula.  I had that, as the formula before asking for advice, but the error keeps coming back that "A number is required here" in the "Commute Method". 
Racquel Burke
IP IP Logged
rburke72
Newbie
Newbie
Avatar

Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Quote rburke72 Replybullet Posted: 03 Aug 2011 at 9:25am
Also, the Attribute Type list is from a pickfromlist.  If that makes any difference.
Racquel Burke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Aug 2011 at 3:59am
what is the Value of the parameter...since it comes from a list of some sort?
 
to debug, I would create several formulas and make them simple.
if x then y, substituting the different fields, this way you can find which part of the formula is erroring out...part of the 'if' or part of the 'then'.  Once you know that, you will have an easier time modifying the formula to work
 
HTH
IP IP Logged
rburke72
Newbie
Newbie
Avatar

Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Quote rburke72 Replybullet Posted: 04 Aug 2011 at 7:03am

So here's a sample of what I my data to create the formula would entail:

 

List of Attribute Types and (Attribute Names)

-Commute Method (type)

  -Bicycle (name)

  -Bus (name)

  -Car/Van Pool (name)

 

So from the Attribute Types, which there are various types, i.e. Commute Method, Computer, Employee Status, Evacuation Skills, and within the Attribute Types are Attribute Names, i.e. Bicycle, Bus, Car/Van Pool, ekstop, Laptop, etc.....I want to know if the Attribute Type is Commute Method and the Attribute Name is Bicycle then show "X". 

 

More than likely I will have to list each Attribute Name across the report and have it mark an "X". 

 

I hope that makes sense.  Again, the Attribute Types are listed as part of a Pickfromlist. 

 

Thanks,

 



Edited by rburke72 - 04 Aug 2011 at 7:04am
Racquel Burke
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Aug 2011 at 9:07am
what I was thinking was that the user was selecting a commute method as a parameter. If this was the case, the 'value' that is being used by the report could be an ID of some sort and not the actual string description.
 
Another scenario is if you joining to the table that has the commute method, then the table that you are referencing might only be holding the ID that points to the description.
 
If you select the table.field using SQL, what value do you get?  This is one of the quickest ways to determine what is going on.  Another is to just display {Attribute Type} on the report and see what is displayed (it is basically what I was alluding to in the first post)
 
if displaying {Attribute Type} on the report and it displays 'Commute Method' but  the formula {Attribute Type} = 'Commute Method'      displays false, then you have an idea where to look.  if {Attribute Type} displays as 7, you also have an idea where to look.  This can be expanded for all the parts of the formula that is failing until you find the part that is incorrect.
 
The error message that you got is very non-specific and could apply to any part (and there were 3 in the formula)...so these are some ideas on how to debug your report.
 
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