Applied Users Forums

General Topics => Helpline => Topic started by: Andrew Carrick on February 06, 2012, 11:39:55 AM

Title: Nested If and Ask statements in Word in TAM
Post by: Andrew Carrick on February 06, 2012, 11:39:55 AM
I'm trying to nest an Ask Variable inside an If Statement but it's not working, anybody know if it's not possible (or is it just me)?
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Lance Bateman on February 06, 2012, 12:16:57 PM
Worked here
First, define the ASK variable.
Then do the IF statement, put something like an X in the true part of the IF formula box as a place marker.
Then, where the X is in the formula, put the cursor there.
Do the ASK statement.

This is the "lazy man" way to do this without having to remember everything, but it worked for me.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Todd Arnold on February 06, 2012, 04:57:00 PM
Post your .rtf file if you'd like one of us to give it a once over for you real quick Andrew.  Like Lance said, it will work.  But I find that posting samples of what working field codes look like to be a much better way of pointing people in the right direction - so post what you are up to so that we someone can repost it with the proper stuff inside.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Andrew Carrick on February 07, 2012, 03:33:27 AM
Here she blows....

I'm trying to insert a paragraph if the insurer is PRU (Pru Health), but within that is a deadline date to be entered by the operator at the point when the letter is done. I have posted it as a .doc since forum says no RTF files allowed.

Thanks in advance.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Lance Bateman on February 07, 2012, 12:11:44 PM
Andrew - could you post one that includes what you tried as far as the "ask" and "if"?
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Andrew Carrick on February 07, 2012, 03:21:06 PM
Not entirely sure I follow you Lance. Can you not see the merge fields in that one? Try F9 to toggle?
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Lance Bateman on February 07, 2012, 03:28:18 PM
I see the merge fields - but I don't see anything with an "IF" or an "ASK".
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Todd Arnold on February 07, 2012, 04:37:34 PM
So, your IF with the ASK inside of it looks good to me Andrew.  One thing though - don't use "date" as the variable name inside of your ASK - that's what word uses, so I think it would be good to avoid it.  Try changing that real quick and then give it another run.  And if it doesn't work, please post which way it's not working; is it failing to prompt the questions, or is it always asking the question?

I'll paste the version that I psuedo tested (meaning I tested it by just replacing data values and then selecting the whole field and doing an <F9> to see if the IF values would change the prompting of the ASK properly vs. actually testing it as part of a TAM merge).  It worked fine for me in this.  But if my suggestion on the variable name change and the pasted code below don't do the trick, I'll put it into a live TAM doc to see what happens.

{ IF "{DOCVARIABLE CPOL.POLICY.BCO}" = "PRU" "A bunch of words before the ask { ASK THEDATE "Enter deadline date for client response"\d"31st March 2012" }{ REF THEDATE } and even more words after the ask
" }
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Lance Bateman on February 07, 2012, 05:24:23 PM
Todd, where was it in his document?
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Todd Arnold on February 07, 2012, 05:28:55 PM
Hey Lance, it's starts in the 4th paragraph down.  Most of that paragraph is contained inside of his IF - be sure to hit ALT+F9 to see it.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Lance Bateman on February 07, 2012, 06:23:34 PM
Thanks Todd - I had not thought to Alt/F9 as I was seeing other things.  And I agree - don't use "reserved" words such as date, total, state, avg, count and so on - for variable names.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Andrew Carrick on February 08, 2012, 03:34:29 AM
Thanks guys, it works now but I think the problem was in fact the BCO If Statement. I had it set to equal the Company Code (PRU) but it appears it was looking for the Company Name (Pru Health). Makes sense actually because at the top of the text I get the letter to insert the Company name using ICO field - it doesn't insert the ICO code.

Got me thinking, I thought I had some other formletters where we have If statements looking at insurer code not name, which would therefore be wrong. I will check, if only for my sanity!

Cheers.
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Jeff Zylstra on February 08, 2012, 10:22:18 AM
Sanity is over rated.   ;)
Title: Re: Nested If and Ask statements in Word in TAM
Post by: Andrew Carrick on February 08, 2012, 10:29:44 AM
A fair point well made.