This article will cover the syntax of the ‘Set’ regular script statement.
This statement is used to set string variables.
Statement syntax
Set variablename = string;
Variablename | The name of the variable. This is the name that will be used to call the variable where needed. |
String | The variable value. |
Example
A ‘set’ statement is used to define a year variable to be used in a ‘where’ clause of a ‘load’ statement.
Set year = 2022;
PINTEREST_DATA:
LOAD
"Date",
Impressions,
"Outbound clicks"
FROM [lib://Public:DataFiles/pinterest_data.xlsx]
(ooxml, embedded labels, table is Sheet1)
WHERE year("Date") >= $(year);
Result
The data is loaded into a table ‘PINTEREST_DATA’ starting from the 1st of January 2022 only.