1. Home
  2. General Topics
  3. List of Available Macros

List of Available Macros

The macros listed below can be used in scripts as well as in calculated columns, alert rules, rules, etc.

The first column in the table shows the name or signature of the macro. The next five columns are descriptions of the parameters that the macro can receive. The Returns column describes what the macro returns when executed and the Example column provides an example of how to use the macro.

MacroParameter1Parameter2Parameter3Parameter4Parameter5ReturnsExampleComment
Number(string x)string that should be converted to numbernumber if successfully converted, or null if notreturn Number("435,45");https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
ToObject(string x)string that should be converted to objectstring converted to objectreturn ToObject("Hello World!");
ToObject(decimal x)number that should be converted to objectnumber converted to objectreturn ToObject("435,45");
Date(string x)string that should be converted to datedate if successfully parsed, or null if notreturn Date("2022-12-20");
Date(string x, string format)string that should be converted to datestring that represents exact date format of the first first parameterdate if successfully parsed, or null if notreturn Date("12/12/2022", "dd/MM/yyyy");
Date(int? year, int? month, int? day)number representing yearnumber representing monthnumber representing daydate if all parameters are not null, else nullreturn Date(2022, 4, 25);
Day(DateTime? date)date from which day will be extractednumber representing day from the datevar date = Date("2022-12-20");
return Day(date);
DayOfWeek(DateTime? date)date from which day of the week will be extractedstring representing day of the week from the datevar date = Date("2022-12-20");
return DayOfWeek(date);
DayOfYear(DateTime? date)date from which day of the year will be extractednumber representing day of the year from the datevar date = Date("2022-12-20");
return DayOfYear(date);
Month(DateTime? date)date from which month will be extractednumber representing month from the datevar date = Date("2022-12-20");
return Month(date);
Year(DateTime? date)date from which year will be extractednumber representing year from the datevar date = Date("2022-12-20");
return Year(date);
Today()today's date return Today();
MinDate()smallest possible datereturn MinDate();
MaxDate()largest possible datereturn MaxDate();
Now()current date with time componentreturn Now();
AddDays(DateTime? date, decimal? days)date upon which days will be addednumber of days to add, can be negative valueincremented date if all parameters are provided, or null if notvar date = Date("2022-12-20");
return AddDays(date, -1);
AddMonths(DateTime? date, int? months);date upon which months will be addednumber of months to add, can be negative valueincremented date if all parameters are provided, or null if notvar date = Date("2022-12-20");
return AddMonths(date, 2);
AddYears(DateTime? date, int? years);date upon which years will be addednumber of years to add, can be negative valueincremented date if all parameters are provided, or null if notvar date = Date("2022-12-20");
return AddYears(date, 1);
AddHours(DateTime? date, int? hours);date upon which hours will be addednumber of hours to add, can be negative valueincremented date if all parameters are provided, or null if notvar date = Date("2022-12-20 13:40:00", "yyyy-MM-dd HH:mm:ss");
return AddHours(date,4);
ConvertUTCTime(DateTime? date, string timeZone)UTC datestring representing destination time zonedate and time in the destination time zone, or null if conversion failedvar date = Date("2022-12-20 13:40:00", "yyyy-MM-dd HH:mm:ss");
return ConvertUTCTime(date,"Eastern Standard Time");
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11
AddBusinessDays(DateTime? date, decimal? offset)date upon which business days will be addednumber of business days to add, can be negative valueincremented date if all parameters are provided, or null if notvar date = Date("2022-12-20");
return AddBusinessDays(date, -1);
TotalMilliseconds(DateTime? startDate, DateTime? endDate)date representing starting point to count millisecondsdate representing end point to count millisecondsnumber representing total milliseconds between startDate and endDatevar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return TotalMilliseconds(startDate, endDate);
TotalSeconds(DateTime? startDate, DateTime? endDate)date representing starting point to count secondsdate representing end point to count secondsnumber representing total seconds between startDate and endDatevar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return TotalSeconds(startDate, endDate);
TotalMinutes(DateTime? startDate, DateTime? endDate)date representing starting point to count minutesdate representing end point to count minutesnumber representing total minutes between startDate and endDatevar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return TotalMinutes(startDate, endDate);
TotalHours(DateTime? startDate, DateTime? endDate)date representing starting point to count hoursdate representing end point to count hoursnumber representing total hours between startDate and endDatevar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return Hours(startDate, endDate);
TotalDays(DateTime? startDate, DateTime? endDate)date representing starting point to count daysdate representing end point to count daysnumber representing total days between startDate and endDatevar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return TotalDays(startDate, endDate);
TotalTime(DateTime? startDate, DateTime? endDate, string timeMeasure)date representing starting point to count timedate representing end point to count timecase insensitive string describing measure of time (milliseconds, seconds, minutes, hours, days)number representing total time between startDate and endDate measured in unit specified in 3rd parameter, or null if measure is wrongvar startDate = Date("2022-12-20");
var endDate = Date("2022-12-25");
return TotalTime(startDate, endDate, "DAYS");
ToString(string value)string to convert to stringconverted stringreturn ToString("Hello World!");
ToString(object value)object to convert to stringconverted stringvar object = ToObject(1);
return ToString(object);
ToString(decimal? value)number to convert to stringconverted stringreturn ToString(16);
ToString(bool? value)boolean to convert to stringconverted stringreturn ToString(true);
ToString(DateTime? value)date to convert to stringconverted stringvar date = Date(2017, 12, 13);
return ToString(date);
ToString(DateTime? value, string format)date to convert to stringstring representing date formatconverted string in specified formatvar date = Date(2017, 12, 13);
return ToString(date, "MM/dd/yyyy");
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
Substring(string literal, int? index)string to take substring fromnumber representing start position of the substring in first parametersubstring from defined positionreturn Substring("Hello World", 6);
Substring(string literal, int? index, int count?)string to take substring fromnumber representing start position of the substring in first parameternumber of characters to takesubstringed from defined position and with defined lengthreturn Substring("Hello World", 6, 1);
Contains(string literal, string value)string representing source to searchstring representing value to search in sourceboolean defining whether parameter1 contains parameter2return Contains("Hello World!", "World");
Contains(List list, string value)list of strings representing source to searchstring representing value to search in sourceboolean defining whether list contains stringreturn Contains([EC Project SDGs], "No Poverty");Can be used on resources that represent array of strings like [EC Project SDGs]
StartsWith(string literal, string value)string to checkstring representing check valueboolean defining whetherfirst parameter starts with second parameterreturn StartsWith("Hello World!", "Hello");
StartsWith(string literal, string value, bool? ignoreCase)string to checkstring representing check valueboolean indicating if check is case insensitiveboolean defining whetherfirst parameter starts with second parameterreturn StartsWith("Hello World!", "hELLo", true);
EndsWith(string literal, string value)string to checkstring representing check valueboolean defining whetherfirst parameter ends with second parameterreturn EndsWith("Hello World!", "World!");
EndsWith(string literal, string value, bool? ignoreCase)string to checkstring representing check valueboolean indicating if check is case insensitiveboolean defining whetherfirst parameter ends with second parameterreturn EndsWith("Hello World!", "wORLd!", true);
Trim(string literal)string to trimstring trimmed of whitespaces from start and endreturn Trim(" Hello World! ");
Trim(string literal, string value)string to trimstring representing trim charactersstring trimmed of specified character sequence from start and endreturn Trim("abcHello World!abc", "abc");
TrimStart(string literal, string value)string to trimstring representing trim charactersstring trimmed of specified character sequence from startreturn Trim("abcHello World!", "abc");
TrimEnd(string literal, string value)string to trimstring representing trim charactersstring trimmed of specified character sequence from endreturn Trim("Hello World!abc", "abc");
Replace(string literal, string oldValue, string newValue)source stringstring representing substring to replace in sourcestring that will replace all occurances of parameter2 in sourcestring with preplaced all occurances of parameter2 with parameter3 in parameter1return Replace("Helloo Woorld!", "oo", "o");
Insert(string literal, decimal? index, string value)string to insert substring tointeger representing position in parameter1 where to inject parameter3string to inject at specified position in source stringstring with injected substring at specified positionreturn Insert("H world!", 1, "ello");
IndexOf(string literal, string value)source stringstring to search for in sourcenumber representing zero based index of the first occurance of the value substring in source string, -1 if not foundreturn IndexOf("Hello World!", "H");
IndexOf(string literal, string value, bool? ignoreCase)source stringstring to search for in sourceboolean indicating if search is case insensitivenumber representing zero based index of the first occurance of the value substring in source string, -1 if not foundreturn IndexOf("Hello World!", "h");
IndexOf(string literal, string value, decimal? index)source stringstring to search for in sourcenumber representing position of search startnumber representing zero based index of the first occurance of the value substring in source string starting at specified position, -1 if not foundreturn IndexOf("Hello World!", "e", 1);
IndexOf(string literal, string value, decimal? index, bool? ignoreCase)source stringstring to search for in sourcenumber representing position of search startboolean indicating if search is case insensitivenumber representing zero based index of the first occurance of the value substring in source string starting at specified position, -1 if not foundreturn IndexOf("Hello World!", "E", 1);
IndexOf(string literal, string value, decimal? index, decimal? count)source stringstring to search for in sourcenumber representing position of search startnumber of character positions to checknumber representing zero based index of the first occurance of the value substring in source string starting at specified position and checking specified number of characters, -1 if not foundreturn IndexOf("Hello World!", "e", 1, 1);
IndexOf(string literal, string value, decimal? index, decimal? count, bool? ignoreCase)source stringstring to search for in sourcenumber representing position of search startnumber of character positions to checkboolean indicating if search is case insensitivenumber representing zero based index of the first occurance of the value substring in source string starting at specified position and checking specified number of characters, -1 if not foundreturn IndexOf("Hello World!", "E", 1, 1);
LastIndexOf(string literal, string value)source stringstring to search for in sourcenumber representing zero based index of the last occurance of the value substring in source string, -1 if not foundreturn LastIndexOf("Hello World!", "l");
LastIndexOf(string literal, string value, bool? ignoreCase)source stringstring to search for in sourceboolean indicating if search is case insensitivenumber representing zero based index of the last occurance of the value substring in source string, -1 if not foundreturn LastIndexOf("Hello World!", "L");
LastIndexOf(string literal, string value, decimal? index)source stringstring to search for in sourcenumber representing position of search startnumber representing zero based index of the last occurance of the value substring in source string starting at specified position and going backwards, -1 if not foundreturn LastIndexOf("Hello World!", "l", 9);
LastIndexOf(string literal, string value, decimal? index, bool? ignoreCase)source stringstring to search for in sourcenumber representing position of search startboolean indicating if search is case insensitivenumber representing zero based index of the last occurance of the value substring in source string starting at specified position and going backwards, -1 if not foundreturn LastIndexOf("Hello World!", "L", 9);
LastIndexOf(string literal, string value, decimal? index, decimal? count)source stringstring to search for in sourcenumber representing position of search startnumber of character positions to checknumber representing zero based index of the last occurance of the value substring in source string starting at specified positionand going backwards and checking specified number of characters, -1 if not foundreturn LastIndexOf("Hello World!", "l", 9, 1);
LastIndexOf(string literal, string value, decimal? index, decimal? count, bool? ignoreCase)source stringstring to search for in sourcenumber representing position of search startnumber of character positions to checkboolean indicating if search is case insensitivenumber representing zero based index of the last occurance of the value substring in source string starting at specified positionand going backwards and checking specified number of characters, -1 if not foundreturn LastIndexOf("Hello World!", "L", 9, 1);
PadLeft(string literal, decimal? totalWidth)source stringnumber of spacesstring that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total lengthreturn PadLeft("Hello World!", 1);
PadLeft(string literal, decimal? totalWidth, string paddingChar)source stringnumber of charactersstring defining characters to pad withstring that right-aligns the characters in this instance by padding them with specified sequence of characters on the left, for a specified total lengthreturn PadLeft("Hello World!", 1, "a");
PadRight(string literal, decimal? totalWidth)source stringnumber of spacesstring that left-aligns the characters in this instance by padding them with spaces on the right, for a specified total lengthreturn PadRight("Hello World!", 1);
PadRight(string literal, decimal? totalWidth, string paddingChar)source stringnumber of charactersstring defining characters to pad withstring that left-aligns the characters in this instance by padding them with specified sequence of characters on the right, for a specified total lengthreturn PadRight("Hello World!", 1, "a");
Remove(string literal, decimal? index)string to remove fromnumber representing position to start removing fromstring where all characters from source string starting from defined position have been removedreturn Remove("Hello World!", 5);
Remove(string literal, decimal? index, decimal? count)string to remove fromnumber representing position to start removing fromnumber of characters to removestring where specified number of characters from source string starting from defined position have been removedreturn Remove("Hello World!", 5, 6);
ToLower(string literal)source stringlowercase string representation of source stringreturn ToLower("HELLO WORLD!");
ToLowerInvariant(string literal)source stringlowercase string representation of source string using the casing rules of invariant culturereturn ToLower("HELLO WORLD!");
ToUpper(string literal)source stringuppercase string representation of source stringreturn ToUpper("hello world!");
ToUpperInvariant(string literal)source stringuppercase string representation of source string using the casing rules of invariant culturereturn ToUpper("hello world!");
Length(string literal)source stringnumber representing length of the source stringreturn Length("Hello World!");
Min(decimal x, decimal y)first number to comparesecond number to comparesmaller of the 2 numbersreturn Min(2,3);
Max(decimal x, decimal y)first number to comparesecond number to comparelarger of the 2 numbersreturn Max(2,3);
Pow(decimal x, decimal y)base numberpower numbernumber x raised to the power of yreturn Pow(3,4);
Abs(decimal x)numberreturns absolute value of the numberreturn Abs(-4);
Acos(decimal x)numbernumber representing angle whose cosine is specified numberreturn Acos(0.25);
Asin(decimal x)numbernumber representing angle whose sine is specified numberreturn Asin(-1);
Atan(decimal x)numbernumber representing angle whose tangent is specified numberreturn Atan(0.5);
Atan2(decimal x, decimal y)number representing x coordinate of the pointnumber representing y coordinate of the pointnumber that represents angle whose tangent is the quotient of two specified numbersreturn Atan2(4,-3);
Ceiling(decimal x)numberReturns the smallest whole value that is greater than or equal to the specified numberreturn Ceiling(3.7);
Cos(decimal x)number representing anglenumber representing cosine of the specified anglereturn Cos(3.14);
Cosh(decimal x)number representing anglenumber representing hyperbolic cosine of the specified anglereturn Cosh(0);
Exp(decimal x)number representing power of ee raised to the specified powerreturn Exp(2);
Floor(decimal x)numberlargest whole number less than or equal to the specified numberreturn Floor(3.3);
IEEERemainder(decimal x, decimal y)dividenddivisorRemainder resulting from the division of a specified number by another numberreturn IEEERemainder(4,3);
Log(decimal x)numbernatural (base e) logarithm of a specified numberreturn Log(5);
Log10(decimal x)numberbase 10 logarithm of a specified numberreturn Log10(6);
Round(decimal x, decimal y)number to be roundednumber of decimal places in the return valuenumber nearest to d that contains a number of fractional digits equal to decimalsreturn Round(2.5432598, 3);
Sign(decimal x)numbernumber that indicates the sign of value, -1 meaning number is negative, 0 number is 0 and 1 meaning number is positivereturn Sign(-45);
Sin(decimal x)number representing anglenumber representing sine of the specified anglereturn Sin(0);
Sinh(decimal x)number representing anglenumber representing hyperbolic sine of the specified anglereturn Sinh(0);
Sqrt(decimal x)numbersquare root of specified numberreturn Sqrt(2);
Tan(decimal x)number representing anglenumber representing tangent of the specified anglereturn Tan(0);
Tanh(decimal x)number representing anglenumber representing hyperbolic tangent of the specified anglereturn Tanh(0);
Truncate(decimal x)decimal numberwhole part of a specified decimal numberreturn Truncate(3.1345);
Count(List list)list of stringsnumber of elements in the listreturn Count([EC Project SDGs]);Can be used on resources that represent array of strings like [EC Project SDGs]
Count(List list)list of objectsnumber of elements in the list
Count(List list)list of numbersnumber of elements in the list
Count(List list)list of booleansnumber of elements in the list
Count(List list)list of datesnumber of elements in the list
FirstOrDefault(List list)list of stringsfirst string from the list or null if list is emptyreturn FirstOrDefault([EC Project SDGs]);Can be used on resources that represent array of strings like [EC Project SDGs]
FirstOrDefault(List list)list of objectsfirst string from the list or null if list is empty
FirstOrDefault(List list)list of numbersfirst object from the list or null if list is empty
FirstOrDefault(List list)list of booleansfirst number from the list or null if list is empty
FirstOrDefault(List list)list of datesfirst boolean from the list or null if list is empty
first date from the list or null if list is empty
Updated on May 10, 2023
Was this article helpful?