Image mailing in an "IF"

p2r -  
 p2r -
Hello,
I successfully tested the excellent and detailed tutorial by m@rina, whom I thank!

However, since I inserted the image merge fields into the IF field, I always retrieve only the first image, despite the Ctrl-A + F9 manipulation. Indeed, in the merge document, there is no INCLUDEPICTURE field to update, but just the image.

Here is the code: (it allows for the insertion of a page break and an image when there is a break on Const1)
{ IF {Const1}<>{Const2}"--------------Page break------------Here is the new image: { INCLUDEPICTURE "{MERGEFIELD Photo}" }" ""}

I suppose it's the fact that the IF results are in quotes (in bold) that blocks it, but I don't see how to avoid that...

Do you have a genius idea?

2 answers

  1. m@rina Posted messages 27633 Registration date   Status Moderator Last intervention   11 564
     
    Good evening,

    We will need to "tweak" things... Indeed, the fields do not pass through the mail merge, except for this specific case of INCLUDEPICTURE because it is a field that looks for an image location.

    So, we will need to create the condition inside the INCLUDEPICTURE. The problem is that if there is no image, it will generate an error. Hence the idea of the tweak: you create a tiny image (a white dot will suffice) that you will name, for example, "nothing.jpg".

    In your main document, you will create two IF fields:

    - The first one inserts the page break and the text if the condition is met.

    - The second one will be inside the INCLUDEPICTURE and will insert the image corresponding to the Photo field if the condition is met, and otherwise the image we named "nothing.jpg".

    This will give:

    { IF { MERGEFIELD Const1}<>{ MERGEFIELD Const2}"--------page break-------here is the new image:" }

    { INCLUDEPICTURE "{ IF { MERGEFIELD Const1} <>{ MERGEFIELD
    Const2} "{ MERGEFIELD photo }" "nothing.jpg"}}

    m@rina

    --
    Beware of herbal tea: it’s a dangerous poison...
    1
  2. p2r
     
    Great, that sounds awesome!
    Thank you so much, m@rina!!!

    I'm going to give this a try...
    0