-
Notifications
You must be signed in to change notification settings - Fork 17
Frontend Macros Filters
The filters listed below work on one main principle: take a value from a macro -> return the changed value.
Some filters may support an argument, such as ifEmpty
, and some may not, such as length
.
Here are some examples of their application:
-
%login|length%
- Getting the length of a value from thelogin
field; -
%login|ifEmpty(empty)%
- Getting the value from the login field. If it is empty, then we get the value "empty"; -
%date_field|addDay(5)|addHour(3)|toDate%
- Getting the value from the date field -> adding 5 days -> adding 3 hours -> formatting the timestamp to the value for the Date Field;
If the macro returns an empty value, the filter will return the value passed in the argument
Any argument, except for the parentheses (
and )
Macro string:
Value from field is: %field_name|isEmpty(empty)%
Result if field_name
is empty:
Value from field is: empty
Result if field_name
is filled with value "123"
Value from field is: 123
Returns the length of the string or array
Macro string:
Number of charatcers from field is: %field_name|length%
Result if field_name
is filled with value "123"
Number of charatcers from field is: 3
Returns the time stamp. Usually used in conjunction with Date & Datetime and Time Field.
For Date Field
%date_field|T%
Result if date_field
is filled with value "2022-10-22"
1666386000000
For Datetime Field
%datetime_field|T%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666450140000
For Time Field
%time_field|T%
Result if time_field
is filled with value "17:49" and today is 2022-10-22. (Today's date is taken as a basis.)
1666018173371
Gets a timestamp from the macro and formats it according to the Date field format
Gets a timestamp from the macro and formats it according to the Datetime field format
Gets a timestamp from the macro and formats it according to the Time field format
Adds minutes via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will add 1 minute
Macro string:
%datetime_field|addMin(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666450440000
Adds hours via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will add 1 hour
Macro string:
%datetime_field|addHour(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666468140000
Adds days via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will add 1 day
Macro string:
%datetime_field|addDay(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666882140000
Adds months via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will add 1 month
Macro string:
%datetime_field|addMonth(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1647964140000
Adds years via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will add 1 year
Macro string:
%datetime_field|addYear(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1824216540000
Subtracts minutes via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will subtract 1 minute
Macro string:
%datetime_field|subMin(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666449840000
Subtracts hours via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will subtract 1 hour
Macro string:
%datetime_field|subHour(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666432140000
Subtracts days via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will subtract 1 day
Macro string:
%datetime_field|subDay(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666018140000
Subtracts montha via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will subtract 1 month
Macro string:
%datetime_field|subMonth(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1653230940000
Subtracts years via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will subtract 1 year
Macro string:
%datetime_field|subYear(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1508683740000
Sets a minute via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will set 0 minute
Macro string:
%datetime_field|setMin(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666447500000
Sets a hour via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will set 0 hour
Macro string:
%datetime_field|setHour(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1666406940000
Sets a day via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will set 1 day
Macro string:
%datetime_field|setDay(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1664981340000
Sets a month via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will set 1 month
Macro string:
%datetime_field|setMonth(5)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1664981340000
Sets a year via an argument to a macro that returns a date or timestamp
Integer only. If no argument is passed, the filter will return the value without changes
Macro string:
%datetime_field|setYear(2017)%
Result if datetime_field
is filled with value "2022-10-22T17:49"
1508683740000
Need more information? Check out the official documentation at jetformbuilder.com or contact Crocoblock Support