New macros/tags

New macros/tags

We are happy to report once more about the rapid cycle between clients expressing desire for a certain feature and our boys delivering. This time around it’s two macros (or tags) you can place anywhere (meaning: from field, subject line, message body).

Random number

Here’s the syntax:

%% RndNum % 21 % 42 %%

This will yield a random number in that range, corner values included. If you punch in a float it will be truncated. If you punch in a negative number it will still work. If you inverse the order (big number first) – it will still work.

Case switch

Developers will recognize this one easily, it’s when you have a variable and you want this: for each specific content (of the variable) I will define a specific output, plus one for when the content is not specified (so a fallback, a default).

Here’s an example, let’s say a bunch of friends was on a week-long fishing trip, and then five days in, at 4am Joe gets a call to come back home stat, wifey is pissed for one reason or another. Weighing his options carefully, he decides it’s best to indeed go back home stat, so he quickly calculates how much he owes everyone (they drink and eat and everything together and settle at the end) and leaves them envelopes before absconding:

Toni - $20
Paulie - $130 (Paulie fronted his share of the trip)
Silvio - it said: Silvio, you owe me $25
Chris - $30
Puss - $40 (see, this was season 1)
Default - call me at 555... and I'll venmo you (he wasn't sure if he owed anyone else so he left this as well, meaning: by default call me and we'll work it out).

So you see, it’s like the variable is called “DEBT”, its specified keys (possible values of the variable) are: Toni, Paulie, Silvio, Chris, Puss and Default, and value for each key, respectively, is: $20, $130, -$25, $30, $40, “call me at 555…. and I’ll venmo you”.

Here’s the general Volo syntax for the case switch macro:

%% switch % VARIABLE_NAME % KEY_1 % VALUE_1 % KEY_2 % VALUE_2 % KEY_3 % VALUE_3 % default % default_value_goes_here %%

Here’s an example:

%% switch % $_sdomain % % Sent from % % Sent from % default % Sent from domain other than acmemailer or emailblaster %%

So there you go, you choose a variable (like $_sdomain) and define output for some of it’s possible values, default for the rest.