Pages: 1
RSS
Recommend New Macro %eval, Recommendation for a new macro
 
I would like to suggest a new macro named %eval that would add some computations (data and numeric) in the templates. Specifically I'd like to be able to do something like

%date(%eval(%date + 1)) to get tomorrow's date to come up. This way I could have a quick template that says:

Your order was processed today and will ship on January 10th, 2009.

%eval would convert whatever is there into a number. Extend %date macro so that %date(a number) would produce a date again.

If there is already a way to do this, I would appreciate any advice on how. Thanks.
 
Well, there is the %Calc macro, though I don't know how good that is with dates.

And the XMP plug-in, downloadable from www.gaijin.at  has a %XMP_TimeCalc macro that might do.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
did You tried %CALC macro?

macro %Eval already existst in MyMacros plugin, but I did not tested it to answer if it does what You want.
 
Hi all!

I've been looking for a way to calculate dates in macros,
and this is how I managed to do it with the help of MyMacros plugin:

Problem:
I would like to add, and subtract, 2 days from today's date,
and present the new date automatically in the format of yyyy-mm-dd.

Solution:
1) %VARtimeback=%CALC="%DATETOCOUNTER(yyyy-mm-dd,%DATE=yyyy-mm-dd) - 2"
2) %VARtimeforward=%CALC="%DATETOCOUNTER(yyyy-mm-dd,%DATE=yyyy-mm-dd) + 2"
3) %COUNTERTODATE("yyyy-mm-dd","%VARtimeback")
4) %COUNTERTODATE("yyyy-mm-dd","%VARtimeforward")

Explanation:
1) & 2)
%VARtimeback and %VARtimeforward is personally made variables.
%CALC is a built in function, and %DATETOCOUNTER is
a part of MyMacros plugin.
You can use any date, even down to minutes and seconds.
In this problem, I've only used the yyyy-mm-dd format, and
thus only integer numbers.
Please see all date formatting possibilities under online help section
[Tools\Scheduler\Date and time formats\Macro Date/Time format]

3) & 4)
%COUNTERTODATE is a part of MyMacros plugin.

3) The output is today's date - 2 days.
4) The output is today's date + 2 days.

I hope this will help anyone else who needs to calculate dates.
-----------------------
I'm not perfect - yet!
If I'm mistaken, please take the time to correct me.
Pages: 1