Mailing software - if starts with then

piotsymbol Posted messages 8 Status Member -  
jee pee Posted messages 31872 Registration date   Status Moderator Last intervention   -

Hello,

I'm working on software that allows exporting fields to generate mail merges.

This software puts the following types of information in the quality field:

- contract A
- contract B
- contract C
- holder A
- holder B

I would like to create a condition like {IF {mergefield Qualite} = Contract* then "text1" else "text2"}

However, putting Contract* doesn't work (it always outputs text2)

Is it possible to set a condition like "if it starts with the term then"?

Or are we forced to set as many conditions as there are existing qualities?

(I hope I was clear)

Currently, my condition is

{IF {mergefield Qualite} = Contract* "text1" "text2"}

8 answers

  1. jee pee Posted messages 31872 Registration date   Status Moderator Last intervention   9 977
     

    Hello,

    I do not use mail merge. But the logic should be to use a string enclosed in quotes.

    {IF {mergefield Qualite} = "Contract*" "text1" "text2"}

    After the use of wildcard characters, is * _ possible? Often with such syntax the operator is not = but like, does it exist in mail merge?

    {IF {mergefield Qualite} like "Contract*" "text1" "text2"}


    0
  2. piotsymbol Posted messages 8 Status Member
     

    Thank you for the feedback

    so with "Contract*" it always returns the second text

    and for the like, I get an error message from my software that says "

     ERROR: the end-of-field merge character is not present. ERROR: The expression is incorrect

    so I'm not sure it recognizes it anyway thanks

    0
  3. jee pee Posted messages 31872 Registration date   Status Moderator Last intervention   9 977
     

    I just took a test, it's the spelling that doesn't work if the field contains "contract A", without a space or dash in front, we shouldn't test Contract* with an uppercase letter but contract*

    {IF {mergefield Qualite} = "contract*" "texte1" "texte2"}


    0
    1. piotsymbol Posted messages 8 Status Member
       

      I just tested

      and alas

      And my field does contain "Contractuel" so contr

      sniff sniff

      have a good weekend

      0
      1. jee pee Posted messages 31872 Registration date   Status Moderator Last intervention   9 977 > piotsymbol Posted messages 8 Status Member
         

        then test = "contract *"

        0
  4. piotsymbol Posted messages 8 Status Member
     

    I'll test this on Monday and let you know otherwise, thanks!

    0
  5. m@rina Posted messages 27507 Registration date   Status Moderator Last intervention   11 562
     

    Good evening,

    Just to add my two cents, the first response from jee pee is perfect. To summarize:

    - Without Like.

    - Word recognizes the wildcard character * (at the end of the field, but neither in the middle nor at the beginning)

    - With quotes

    - With case sensitivity: Word, unlike Excel, is case-sensitive. So, if you wrote "contrat A" in the database, you need to put "contrat*", without a capital letter.

    I still advise you to check your database and see if everything is consistent. I didn’t understand your last comment which says "my field does contain 'Contractuel', which does not correspond to your first request."

    m@rina


    0
    1. piotsymbol Posted messages 8 Status Member
       

      thank you for the feedback

      I will test it

      actually, I work in the public service and there are different types of contractual employees.. My goal is that regardless of the type of contract, a specific law text appears. And all my contractual fields start with Contr

      0
  6. piotsymbol Posted messages 8 Status Member
     

    Unfortunately, I think the problem must come from the software export

    Because if I type the exact term "Contractuel (CAP)

    I get

    which gives

    but if I put only "Contractuel*"

    I have

    I don't think I'm missing anything.. I respect the box, after all... I might be wrong :)

    In any case, thank you!

    0
  7. m@rina Posted messages 27507 Registration date   Status Moderator Last intervention   11 562
     

    Hello,

    Well yes, you can make a mistake, you never know!! But without seeing your files, we don't know...

    m@rina


    0
    1. piotsymbol Posted messages 8 Status Member
       

      Hello

      Thank you for your feedback

      I'm sending the relevant part of the file because at my work I can't access any servers

      {IF «Nouveau_EB_QUALIB» = "Contractuel*" "the decree n°88-145 of February 15, 1988 issued for the application of article 136 of the law of January 26, 1984 amended concerning statutory provisions relating to the local public service and concerning contractual agents of the local public service"  "toto"}

      So my field contains the expression "Contractuel (CAP)"

      But if I set it to "Contractuel*" it outputs toto and not the text

      0
  8. jee pee Posted messages 31872 Registration date   Status Moderator Last intervention   9 977
     

    We should start over with a simple environment to test this case, which works for me. Create an Excel file (or .csv?) with data including "Contractual (CAP)" and a new Word mail merge document and test with these 2 new files. If that doesn’t work, upload these 2 files to a site like cjoint.com and provide us with the links.

    If these 2 new files work, test your original Word with the new Excel file, then your new Word with the original database.


    0