Author |
Topic |
|
hcross
37 Posts |
Posted - Nov 04 2009 : 12:31:24
|
Nigel and all,
OS - Windows 7 MLK ver 8.62
I would like to do conditional testing (if, then-else or case statements). I'm struggling with the syntax though. I have several additional custom fields in my record. One of which contains a numeric value to indicate a delivery zone. I send out delivery notices all my customers in the whole territory at the start of the week. I would like to remind them of which day I'll be in their part of the state. (delivery zone: 1 = monday, zone 2 = tuesday, etc. We deliver Monday thru Friday.)
This is what I've tried:
%condition:delivery zone=1%Monday or Thursday %condition:delivery zone=2%Tuesday %condition:delivery zone=3%Wednesday %condition:delivery zone=4%Friday %condition:end%
%field:delivery zone% yields the proper result. I can get the
Obviously, it doesn't work. Have I done something improperly or is what I'm trying to do beyond the scope of MLK?
-- howard
-- howard cross |
|
xequte
7042 Posts |
Posted - Nov 04 2009 : 15:31:45
|
Hi Howard
Each conditional statement needs to be in the format:
%Condition:Some_Condition%The conditional text%Condition:End%
or
%Condition:Some_Condition%The conditional text%Condition:Else%Alternative text%Condition:End%
So your statements failed because three of your %Condition:Some_Condition% did not have a matching %Condition:End%.
Also custom fields that contain spaces are shown with underlines. Your statement should be:
%condition:delivery_zone=1%Monday or Thursday%condition:end% %condition:delivery_zone=2%Tuesday%condition:end% %condition:delivery_zone=3%Wednesday%condition:end% %condition:delivery_zone=4%Friday%condition:end%
(I just put them on separate lines to make it easier to read. It doesn't need to be).
Also you should use the function Personalize > Insert Conditonal Text on the message sending toolbar to automatically build the conditional text string for you.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
hcross
37 Posts |
Posted - Nov 04 2009 : 20:40:06
|
Thanks Nigel!
It appears as though the personalization is case sensitive and needs to be all caps. Is that correct?
-- howard cross |
|
|
xequte
7042 Posts |
Posted - Nov 05 2009 : 15:48:13
|
Hi Howard
No, it should be case-insensitive. Can you give me more detail so I can investigate.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
hcross
37 Posts |
Posted - Nov 06 2009 : 19:23:46
|
Hi there Nigel,
1. %condition:delivery_zone=3%Good + 10% discount coupon %condition:end% 2. %CONDITION:Delivery_Zone=3%Good + 10% discount coupon %CONDITION:END%
Above statement #1 does not work and statement #2 does. The alert box indicates "pos 285: "%CONDITION:END%" outside of any condition"
BTW - Is there any way to insert a text file into the body of an email based on the results of such a conditional test?
-- howard cross |
|
|
xequte
7042 Posts |
Posted - Nov 07 2009 : 00:36:50
|
Hi Howard
Thanks I will investigate.
Off the top of my head (I'm out of the office for the weekend) I believe you can have a %Read_From_File:C:\xyz.txt% field inside a conditional text condition. Please try it and confirm :-)
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
hcross
37 Posts |
Posted - Nov 07 2009 : 08:42:32
|
Hi Nigel,
I hope you're having a great trip. Please don't work on this any more until you get back.
Yes, I could nest the read from file in a conditional test.
%CONDITION:Delivery_Zone=3%%Read_From_File:C:\Users\Zoe\Desktop\test_1.txt%%CONDITION:END%
At first I had trouble because it appears as though it will not read files on my local network file-server. However, it will read files from my local drive.
Question: if the field value is null, what is the test statement? I thought it might be something such as %CONDITION:Delivery_Zone=""% What I got to work was %CONDITION:Delivery_Zone=%
BTW - CONDITION/CONDITION:END have to be all caps. I double checked this morning thinking it might be something I'm doing on my end.
thanks again
-- howard cross |
|
|
xequte
7042 Posts |
Posted - Nov 07 2009 : 23:44:17
|
Hi Howard
Not on holiday yet, i'm afraid.
The test statement for null checking is:
%CONDITION:Delivery_Zone=NOTHING%
or
%CONDITION:Delivery_Zone=%
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
xequte
7042 Posts |
Posted - Nov 08 2009 : 18:51:56
|
Hi Howard
Sorry, have checked the code and to clarify; Conditional text commands need to be all uppercase.
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
|
|
hcross
37 Posts |
Posted - Nov 09 2009 : 06:26:23
|
Thanks!
-- howard cross |
|
|
|
Topic |
|