ICU Time + Multiple Variables

I am trying to expand multi variables into the ICUTime Forumla

Basically taking

  • Type (Date format)

  • Digit (number of unit)

  • Unit (Days/Weeks/Months/Years)

into

%ICUDateTimePlus%Snippet_Date_Digit% Snippet_Date_Unit%Snippet_Date_Format%

Any pointers on how to do this properly?

The ICUDateTimePlus token documents the format:

%ICUDateTimePlus%3+6%Hours%format% - the current time plus a specified number of the specified time units.

The first field (“3+6”) is a numeric calculation, and so you can include any calculation including variables.

The second two fields are strictly text, they cannot contact variables or tokens or anything else.

The second field is strictly text, it cannot contact variables or tokens or anything else. The options for this field are listed on the ICUDateTimePlus documentation (things like “Hours”, “Days”, “Fridays”, etc).

The third field is also strictly text, no tokens or variables. The form of this is as describe in the ICU Date/Time Format Syntax.

If you wish to interpolate variables in to this token, you need to do it in two steps - first you need to create the token as desired, and then use the Filter action to process the tokens. Be very careful when doing this to double any percent characters that are intended to be percent characters fed to the Filter action. Or build it up piecemeal with multiple actions, some of which have processing turned off.

For example:

  • Set variable "MyToken" to "%ICUDateTimePlus%" - configured with No Processing.
  • Set variable "Amount" to calculation "whatever you want"
  • Append to variable "MyToken" "%Variable%Amount%" - configured with Normal Processing
  • Append to variable "MyToken" "%" - configured with No Processing
  • Append to variable "MyToken" "%Variable%Unit%" - configured with Normal Processing
  • Append to variable "MyToken" "%" - configured with No Processing
  • Append to variable "MyToken" "%Variable%Format%" - configured with Normal Processing
  • Append to variable "MyToken" "%" - configured with No Processing
  • Display Text in Window "Processing: %Variable%MyToken%" <- double check that it looks correct
  • Filter Variable MyToken with Process Tokens
  • Display Text in Window "Result: %Variable%MyToken%" <- double check that it looks correct

or:

  • Set Variable “MyToken” to text “%%ICUDateTimePlus%%%Variable%Amount%%%%Variable%Unit%%%%Variable%Format%%%”
  • Display Text in Window "Processing: %Variable%MyToken%" <- double check that it looks correct
  • Filter Variable MyToken with Process Tokens
  • Display Text in Window "Result: %Variable%MyToken%" <- double check that it looks correct
3 Likes

This does not appear to be working still.

It looks like you have the numberic and unit sections reversed. The final variable should be %ICUDateTimePlus%1%Days%MM/d/yyyy%.

2 Likes