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)?
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.
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.
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.
Andrew - could you post one that includes what you tried as far as the "ask" and "if"?
Not entirely sure I follow you Lance. Can you not see the merge fields in that one? Try F9 to toggle?
I see the merge fields - but I don't see anything with an "IF" or an "ASK".
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
" }
Todd, where was it in his document?
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.
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.
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.
Sanity is over rated. ;)
A fair point well made.