Is it possible to create nested IF statement?

M

Matt M

I am trying to create a form with a nested IF statement.
I am creating a performance appraisal form, so what I need
the nested IF for is to translate the numerical score that
the user enters into the text translation.

Example
"1" = Does not deliver
"2" = Achieved

etc., etc.

I found an article on nested IFs for mail merge which
suggested the following format:

{IF test1 "TrueResult" "{IF
test2 "TrueResult" "FalseResult"}"}

however this is not working. Anyone have experience
creating something like this?
 
G

Greg Maxey

Matt,

Nested IF fields are certainly possible but I can't follow what you are
trying to do. One thing I don't se is a comparison expressiong (e.g., equal
sign) in your IF field.

Here is one example of a nested IF field:
{ IF BrandName = "Daikin" "Daiken is a generic brand" "{ IF BrandName =
"CONAIC" "Concia is a relatively new brandt" "{ IF BrandName = "Advil"
"Take two and call me in the moring" "Not a valid brand name" }" } }

Basically makes a comparison (e.g., BrandName " Daikin") and returns first
choice (i.e., Daiken is a generic bran) if the comarion is true or the
sencond choice (in this case another IF comparison) if the comparison is
false.
 
M

mcelhatt

Greg-

Thanks for your response. What you are descibing is
definitely what I am trying to achieve. When I tried to
replicate you example in Word, it was not successful.
Basically, the result was simply a concatenated version of
what I typed in. After I entered in your example, and
selected "Update Field" - the result was "not a valid
brand name" when I selected "toggle field code" the
formula was then changed to the following:


{IF BrandName = "CONCIA" "Concia is a relatively new
brand" "Not a valid brand name"}

I am entering in the field braces using CTRL F9, is that
correct?
 
P

Peter Jamieson

If BrandName is the name of a bookmark (e.g. as defined in the form field
properties) I'd use

{ IF { REF BrandName } = "CONCIA" "Concia is a relatively new
brand" "Not a valid brand name" }

or even

{ IF "{ REF BrandName }" = "CONCIA" "Concia is a relatively new
brand" "Not a valid brand name" }

Ensure that the "=" sign has a space on each side.

But I'd also want to be sure that the bookmark BrandName actually contained
the exact value "CONCIA" (e.g. not "Concia") at the time I executed the IF
field, or use e.g.

{ IF "{ REF BrandName \*Upper }" = "CONCIA" "Concia is a relatively new
brand" "Not a valid brand name" }

If you are getting your BrandName from a merge data source, you'd need

{ IF "{ MERGEFIELD BrandName }" = "CONCIA" "Concia is a relatively new
brand" "Not a valid brand name" }
I am entering in the field braces using CTRL F9, is that
correct?

Yes - when you nest fields, /all/ the field braces need to be these special
characters, not the ordinary keyboard {}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top