Need help with syntax

Moderators: Moderators, Tech Support

Post Reply
John Dykema
Posts: 320
Joined: Sun Sep 28, 2003 5:37 pm
Location: First Cutlerville Christian Reformed Church
Contact:

Need help with syntax

Post by John Dykema »

I need help with the syntax when writting my custom reports. Seems I'm always screwing up the ifs/ands/or commands. What manual or For Dummies book would you recommend to help me with this language?

For example: my code of-
IIF((status_desc = "Member" ) OR (status_desc = "Inactive member"), "Member", "Not a member")
is always coming back False (Not a member).
I'm not getting any members. What's a better way to state this? It veryifies clean. :wall:

Tracy
Program Development
Program Development
Posts: 463
Joined: Fri Sep 05, 2003 3:08 pm
Location: PowerChurch Software
Contact:

Re: Need help with syntax

Post by Tracy »

This is Visual FoxPro. The example you are showing should work, if you've spelled and cased the text correctly. To prevent loss of functionality when someone changes the case of the values you could do this:

Code: Select all

IIF(UPPER(status_desc) = "MEMBER" OR UPPER(status_desc) = "INACTIVE MEMBER", "Member", "Not a member")
If you need to be more exact this syntax would be used (the double equal means they need to exactly match:

Code: Select all

IIF(UPPER(ALLTRIM(status_desc)) == "MEMBER" OR UPPER(ALLTRIM(status_desc)) == "INACTIVE MEMBER", "Member", "Not a member")
Tracy

John Dykema
Posts: 320
Joined: Sun Sep 28, 2003 5:37 pm
Location: First Cutlerville Christian Reformed Church
Contact:

Re: Need help with syntax

Post by John Dykema »

Thanks, I used your syntax and now it works fine.

Post Reply