Mailing software - if starts with then
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
-
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"}
-
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
-
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"}
-
I just tested
I'll test this on Monday and let you know otherwise, thanks!
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
Hello,
Well yes, you can make a mistake, you never know!! But without seeing your files, we don't know...
m@rina
-
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
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.
-