I am looking for a way to test a variable for a particular value and then have the output be some simple text. For example, the following expression works good:
IIF(PCPLUS.subacct="100","Pastoral","Administrative")
However I have twelve tests to do. I could do a nested IIF statement but was wondering if FOXPRO had a better logical function. There was a old CASE function from my Pascal days. I looked thru
http://msdn.microsoft.com/library/defau ... ctions.asp
but couldn't find a quick answer.
Am I stuck with the nested IF statements?
I saw a DO CASE commande but figured that was to complicated for the Custom Reports module. Can I build a CASE statement from within Custom Reports?
Nested IF Statements
Moderators: Moderators, Tech Support
Nested IF Statements
Garland Tackett, Director of Administration
Redeemer Covenant Church
Tulsa OK
Using PC+ Ver 10.4
Redeemer Covenant Church
Tulsa OK
Using PC+ Ver 10.4
-
- Program Development
- Posts: 463
- Joined: Fri Sep 05, 2003 3:08 pm
- Location: PowerChurch Software
- Contact:
A case statement cannot be done with in the report. The report variables and texts are limited to 254 characters (If I remember correctly). To maintain some clarity in the nested IIF(), use the Variables available in the report and nest them. Remember variable names in the report are named what you like (var1) and used in the report with an ‘m.’ in front of them (m.var1).
Tracy
I tried your suggestion. Here is the expression I tried to build:
IIF(subacct=100,"Pastor",IIF(subacct=200,"Admin",IIF(subacct=310,"Wor",
IIF(subacct=400,"Evan",IIF(subacct=500,"Cong",IIF(subacct=610,"Disc",
IIF(subacct=690,"Educ",IIF(subacct=691,"Nur",IIF(subacct=695,"StuMin",
IIF(subacct=696,"Pre",IIF(subacct=700,"Miss","Prop")))))))))))
(I trouble typing all this in so I had to include the carriage returns in this post. These CR's are obviously not in my expression.)
This was too many characters. Any suggestions?
IIF(subacct=100,"Pastor",IIF(subacct=200,"Admin",IIF(subacct=310,"Wor",
IIF(subacct=400,"Evan",IIF(subacct=500,"Cong",IIF(subacct=610,"Disc",
IIF(subacct=690,"Educ",IIF(subacct=691,"Nur",IIF(subacct=695,"StuMin",
IIF(subacct=696,"Pre",IIF(subacct=700,"Miss","Prop")))))))))))
(I trouble typing all this in so I had to include the carriage returns in this post. These CR's are obviously not in my expression.)
This was too many characters. Any suggestions?
Garland Tackett, Director of Administration
Redeemer Covenant Church
Tulsa OK
Using PC+ Ver 10.4
Redeemer Covenant Church
Tulsa OK
Using PC+ Ver 10.4
-
- Program Development
- Posts: 463
- Joined: Fri Sep 05, 2003 3:08 pm
- Location: PowerChurch Software
- Contact:
I suggested nesting the IIF() with variables, create something like the following variables. (Order does matter, create them in nested order, as shown.)
IIF_Miss
IIF(subacct=700,”Miss”,”Prop”)
IIF_Pre
IIF(subacct=696,”Pre”,m.IIF_Miss)
IIF_StuMin
IIF(subacct=695,”StuMin”,m.IIF_Pre)
If these were the only three variables (you have more), the only variable needed to used in the report field object is m.IIF_StuMin.
IIF_Miss
IIF(subacct=700,”Miss”,”Prop”)
IIF_Pre
IIF(subacct=696,”Pre”,m.IIF_Miss)
IIF_StuMin
IIF(subacct=695,”StuMin”,m.IIF_Pre)
If these were the only three variables (you have more), the only variable needed to used in the report field object is m.IIF_StuMin.
Tracy