Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: IF Statement Hierarchy - Word 2000

Geek News

IF Statement Hierarchy - Word 2000
Chris Stammers 5/15/2007 11:55:02 AM
Hello,

Is there a hierarchy in an IF statement? I ask because I have a mailmerge
that is looking at certain criteria to generate a particular letter version
if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
{MERGEFIELD field2 } = 1 "LETTER" "" }" }

I should say, that within the merge, there are 2 variations of the above,
the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } <>
1 "LETTER2" "" }" }

There are then queries within the paragraphs of the letters to determine
what the paragraph should say and various formatting queries. It works - kind
of - but in the first version it also seems to be generating the letter where
the second field ISN'T '1', and dropping out part of one of the paragraphs.
It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
all makes some sort of sense.......)

Thanks,
Chris


RE: IF Statement Hierarchy - Word 2000
Chris Stammers 5/15/2007 3:18:01 PM
Hello,

Please ignore this last question; I have since sorted the problem out.
However, do things like Continuous Breaks and the position the query is
placed in the document have an effect on whether or not a merge will work? I
have a query I got from Peter and Graham to format currency to remove the
decimal point from a pence figure. This is on one document in several places
and works fine, but I have have it in another document where it is only used
once and the document generates with 'Field Calculation Error occurred in
record 1' etc.

Does anyone have any thoughts?

Thanks,
Chris

Thanks,
Chris


"Chris Stammers" wrote:

[Quoted Text]
> Hello,
>
> Is there a hierarchy in an IF statement? I ask because I have a mailmerge
> that is looking at certain criteria to generate a particular letter version
> if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
> {MERGEFIELD field2 } = 1 "LETTER" "" }" }
>
> I should say, that within the merge, there are 2 variations of the above,
> the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } <>
> 1 "LETTER2" "" }" }
>
> There are then queries within the paragraphs of the letters to determine
> what the paragraph should say and various formatting queries. It works - kind
> of - but in the first version it also seems to be generating the letter where
> the second field ISN'T '1', and dropping out part of one of the paragraphs.
> It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
> all makes some sort of sense.......)
>
> Thanks,
> Chris
>
>
Re: IF Statement Hierarchy - Word 2000
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 5/15/2007 3:23:58 PM
At the moment I can't see anything wrong with either of the IF fields :-(
Personally I would always put the other result in (a "" before the final
"}" ) but I don't think it should make any difference).

But what exactly is in the field where you have put "LETTER" ? Is it
literallyt the word LETTER, a set of fields and text, an INCLUDETEXT, or
what (If you have used an INCLUDETEXT, then there could be a problem)

Peter Jamieson


"Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
news:4DD17F8F-1F96-41E4-A0A1-857813E549B3[ at ]microsoft.com...
[Quoted Text]
> Hello,
>
> Is there a hierarchy in an IF statement? I ask because I have a mailmerge
> that is looking at certain criteria to generate a particular letter
> version
> if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
> {MERGEFIELD field2 } = 1 "LETTER" "" }" }
>
> I should say, that within the merge, there are 2 variations of the above,
> the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
> <>
> 1 "LETTER2" "" }" }
>
> There are then queries within the paragraphs of the letters to determine
> what the paragraph should say and various formatting queries. It works -
> kind
> of - but in the first version it also seems to be generating the letter
> where
> the second field ISN'T '1', and dropping out part of one of the
> paragraphs.
> It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
> all makes some sort of sense.......)
>
> Thanks,
> Chris
>
>

Re: IF Statement Hierarchy - Word 2000
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 5/15/2007 3:26:02 PM
In the case of { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } = 1
"LETTER" "" }" }

field1 would be evaluated and if it equals 2, then Field 2 would be
evaluated. If it equals one, the word "LETTER" would be inserted. If
neither condition is met, nothing would be inserted.

Note, you do not need the quote marks around

{ IF {MERGEFIELD field2 } = 1 "LETTER" "" }

Are you sure that the fields always contain numeric values?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
news:4DD17F8F-1F96-41E4-A0A1-857813E549B3[ at ]microsoft.com...
[Quoted Text]
> Hello,
>
> Is there a hierarchy in an IF statement? I ask because I have a mailmerge
> that is looking at certain criteria to generate a particular letter
> version
> if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
> {MERGEFIELD field2 } = 1 "LETTER" "" }" }
>
> I should say, that within the merge, there are 2 variations of the above,
> the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
> <>
> 1 "LETTER2" "" }" }
>
> There are then queries within the paragraphs of the letters to determine
> what the paragraph should say and various formatting queries. It works -
> kind
> of - but in the first version it also seems to be generating the letter
> where
> the second field ISN'T '1', and dropping out part of one of the
> paragraphs.
> It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
> all makes some sort of sense.......)
>
> Thanks,
> Chris
>
>


Re: IF Statement Hierarchy - Word 2000
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 5/15/2007 3:30:17 PM
[Quoted Text]
> However, do things like Continuous Breaks and the position the query is
> placed in the document have an effect on whether or not a merge will work?

No, except
a. in the obvious sense that you want the results to be laid out how they
need to be laid out :-)
b. putting breaks in the middle of a field name (for example) is probably
not going to work.

> once and the document generates with 'Field Calculation Error occurred in
> record 1' etc.

Can you see the value of the number that seems to cause the problem?

Peter Jamieson

"Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
news:F0E606BC-AC12-4F32-829F-4CCFAD3278F4[ at ]microsoft.com...
> Hello,
>
> Please ignore this last question; I have since sorted the problem out.
> However, do things like Continuous Breaks and the position the query is
> placed in the document have an effect on whether or not a merge will work?
> I
> have a query I got from Peter and Graham to format currency to remove the
> decimal point from a pence figure. This is on one document in several
> places
> and works fine, but I have have it in another document where it is only
> used
> once and the document generates with 'Field Calculation Error occurred in
> record 1' etc.
>
> Does anyone have any thoughts?
>
> Thanks,
> Chris
>
> Thanks,
> Chris
>
>
> "Chris Stammers" wrote:
>
>> Hello,
>>
>> Is there a hierarchy in an IF statement? I ask because I have a mailmerge
>> that is looking at certain criteria to generate a particular letter
>> version
>> if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
>> {MERGEFIELD field2 } = 1 "LETTER" "" }" }
>>
>> I should say, that within the merge, there are 2 variations of the above,
>> the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
>> <>
>> 1 "LETTER2" "" }" }
>>
>> There are then queries within the paragraphs of the letters to determine
>> what the paragraph should say and various formatting queries. It works -
>> kind
>> of - but in the first version it also seems to be generating the letter
>> where
>> the second field ISN'T '1', and dropping out part of one of the
>> paragraphs.
>> It shouldn't be generating at all! HELP, it's driving me mad! (I hope
>> this
>> all makes some sort of sense.......)
>>
>> Thanks,
>> Chris
>>
>>

Re: IF Statement Hierarchy - Word 2000
Chris Stammers 5/15/2007 3:31:00 PM
It is a complete letter. I just put 'LETTER' for ease of explanation (!).
This is now working after a bit of playing about.

Thanks,
Chris

"Peter Jamieson" wrote:

[Quoted Text]
> At the moment I can't see anything wrong with either of the IF fields :-(
> Personally I would always put the other result in (a "" before the final
> "}" ) but I don't think it should make any difference).
>
> But what exactly is in the field where you have put "LETTER" ? Is it
> literallyt the word LETTER, a set of fields and text, an INCLUDETEXT, or
> what (If you have used an INCLUDETEXT, then there could be a problem)
>
> Peter Jamieson
>
>
> "Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
> news:4DD17F8F-1F96-41E4-A0A1-857813E549B3[ at ]microsoft.com...
> > Hello,
> >
> > Is there a hierarchy in an IF statement? I ask because I have a mailmerge
> > that is looking at certain criteria to generate a particular letter
> > version
> > if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
> > {MERGEFIELD field2 } = 1 "LETTER" "" }" }
> >
> > I should say, that within the merge, there are 2 variations of the above,
> > the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
> > <>
> > 1 "LETTER2" "" }" }
> >
> > There are then queries within the paragraphs of the letters to determine
> > what the paragraph should say and various formatting queries. It works -
> > kind
> > of - but in the first version it also seems to be generating the letter
> > where
> > the second field ISN'T '1', and dropping out part of one of the
> > paragraphs.
> > It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
> > all makes some sort of sense.......)
> >
> > Thanks,
> > Chris
> >
> >
>
Re: IF Statement Hierarchy - Word 2000
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 5/15/2007 3:33:09 PM
BTW I would call \#"00p" a "query" - these things are normally called by
other jargon expressions, e.g. "numeric switch" or "numeric picture switch".

Peter Jamieson

"Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
news:F0E606BC-AC12-4F32-829F-4CCFAD3278F4[ at ]microsoft.com...
[Quoted Text]
> Hello,
>
> Please ignore this last question; I have since sorted the problem out.
> However, do things like Continuous Breaks and the position the query is
> placed in the document have an effect on whether or not a merge will work?
> I
> have a query I got from Peter and Graham to format currency to remove the
> decimal point from a pence figure. This is on one document in several
> places
> and works fine, but I have have it in another document where it is only
> used
> once and the document generates with 'Field Calculation Error occurred in
> record 1' etc.
>
> Does anyone have any thoughts?
>
> Thanks,
> Chris
>
> Thanks,
> Chris
>
>
> "Chris Stammers" wrote:
>
>> Hello,
>>
>> Is there a hierarchy in an IF statement? I ask because I have a mailmerge
>> that is looking at certain criteria to generate a particular letter
>> version
>> if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
>> {MERGEFIELD field2 } = 1 "LETTER" "" }" }
>>
>> I should say, that within the merge, there are 2 variations of the above,
>> the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
>> <>
>> 1 "LETTER2" "" }" }
>>
>> There are then queries within the paragraphs of the letters to determine
>> what the paragraph should say and various formatting queries. It works -
>> kind
>> of - but in the first version it also seems to be generating the letter
>> where
>> the second field ISN'T '1', and dropping out part of one of the
>> paragraphs.
>> It shouldn't be generating at all! HELP, it's driving me mad! (I hope
>> this
>> all makes some sort of sense.......)
>>
>> Thanks,
>> Chris
>>
>>

Re: IF Statement Hierarchy - Word 2000
Chris Stammers 5/15/2007 3:41:01 PM
There is a mix of fields in the AS400 data source however what I was trying
to get to was IF MERGEFIELD field1 = 2 AND field2 = 1, then insert the
appropriate letter, otherwise don't do anything and move on to the next query
in the document which, if I understand correctly, is what you are saying.
After quite exhaustive testing, this is now working.

"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> In the case of { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 } = 1
> "LETTER" "" }" }
>
> field1 would be evaluated and if it equals 2, then Field 2 would be
> evaluated. If it equals one, the word "LETTER" would be inserted. If
> neither condition is met, nothing would be inserted.
>
> Note, you do not need the quote marks around
>
> { IF {MERGEFIELD field2 } = 1 "LETTER" "" }
>
> Are you sure that the fields always contain numeric values?
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Chris Stammers" <ChrisStammers[ at ]discussions.microsoft.com> wrote in message
> news:4DD17F8F-1F96-41E4-A0A1-857813E549B3[ at ]microsoft.com...
> > Hello,
> >
> > Is there a hierarchy in an IF statement? I ask because I have a mailmerge
> > that is looking at certain criteria to generate a particular letter
> > version
> > if that criteria is met, so it says { IF { MERGEFIELD field1 } = 2 "{ IF
> > {MERGEFIELD field2 } = 1 "LETTER" "" }" }
> >
> > I should say, that within the merge, there are 2 variations of the above,
> > the other being { IF { MERGEFIELD field1 } = 2 "{ IF {MERGEFIELD field2 }
> > <>
> > 1 "LETTER2" "" }" }
> >
> > There are then queries within the paragraphs of the letters to determine
> > what the paragraph should say and various formatting queries. It works -
> > kind
> > of - but in the first version it also seems to be generating the letter
> > where
> > the second field ISN'T '1', and dropping out part of one of the
> > paragraphs.
> > It shouldn't be generating at all! HELP, it's driving me mad! (I hope this
> > all makes some sort of sense.......)
> >
> > Thanks,
> > Chris
> >
> >
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net