PDA

View Full Version : Solved: To Test Whether Conditions are Met



Victor
08-02-2011, 12:18 PM
Hi:


I am trying to write a merge code if for my letter using field codes.

The 2 merge fields are:

TipoMem (text value)
MesFechaEfecDes (text value)

What I am saying is:

If both values "1" and "8" are met I want to write "$40.00



{IF { = and ( { COMPARE «TipoMem» = “1”}, { COMPARE «MesFechaEfecDes»= “8” } ) } = "$40.00" "" }


The merge for this "if" do no run, it just present the instructions in text after pressing merge.


Please help me with this.


Thanks

Victor

Victor
08-09-2011, 04:31 PM
After a little research help:

Look here: http://support.microsoft.com/kb/214827/EN-US
and here: http://support.microsoft.com/kb/211363

The final result is:
{IF {MERGEFIELD "Month">}="1" "{IF MERGEFIELD "Month"}<="3" "{IF
{MERGEFIELD "Type"}="1" "$40.00"}" } " "}
The trick for me is to be sure that you enclosed the True and False IF
betwwen " ".
Of course be patient and careful building it.

Thanks

Victor

macropod
08-14-2011, 03:24 AM
Hi Victor,

Following on from your other post, it seems to me you could do this with:
{={={MERGEFIELD MesFechaEfecDes \@ "MM"}= 8}*{={MERGEFIELD TipoMem}= 1} \# "'$40.00';;1}

Victor
08-14-2011, 06:12 AM
Hi Paul,

Thanks for the recommendation.

This other way is equivalent to an Excel array and that is why you multiply the field codes? Any advantages of one over the other or just a personal choice?

Thanks for the help.

Victor

macropod
08-15-2011, 01:04 AM
Hi Victor,

Actually, the approach is quite unrelated to Excel array formulae, in spite of the apparent similarity to some Excel array formulae you may have seen. Multiplying values like I've done with the field code isn't limited to array formulae in Excel - it can be done in ordinary formulae as well.

The other significant difference is that the output is encoded in the final field switch itself - which is akin to putting it in the cell number formatting in Excel.

The possible advantage of my approach is that it leaves the field code formulae active so that you can see what the outputs of the different mergefields were. This can be useful for debugging purposes. OTOH, some might see that as a disadvantage - in which case, simply enclosing the field code in a QUOTE field will cause the output document to hold only the final result.

Victor
08-15-2011, 08:58 AM
Hi Paul:

Thanks for the explanation.

In your array

{={={MERGEFIELD MesFechaEfecDes \@ "MM"}= 8}*{={MERGEFIELD TipoMem}= 1} \# "'$40.00';;1}

"$40.00" is the true condition
;; is the false condition (nothing)
;;1 What is the meaning of the 1 in this position?

Thanks for the information.

Victor

macropod
08-19-2011, 08:50 PM
Hi Victor,

Not at all! The:
• "$40.00" represents the output for any +ve non-zero value
• empty space between the semi-colons is for -ve values
• '1' represents the output for zero values

Victor
08-22-2011, 09:57 AM
Thanks, Paul:

Can you recommend me some links where I can read additional information about field codes calculation?

Thanks,

Victor