A variable is a container that stores a specific piece of data collected from the client or results from simulations performed. Variables, being containers of information, have great versatility in their use. They can act both as inputs to receive data from the user, and as outputs to display results or messages. Furthermore, variables can be inserted as part of the text in messages, images and graphics. This means that they are not only useful for storing numerical data or simple text strings, but can also be integrated into visual and communication elements.
Where can I find this option? → Left side menu → Settings → Variable management
Remember that this tab will only be visible if you have the permissions enabled: View Report Variables
What is a variable?
A "variable" is a specific piece of data in the client's file that is necessary to complete a report or an email. Variables are used to fill in gaps in a document (report) or in email templates. By using variables, we can print data from the offer or simulation carried out in the report that will later be sent to the client.
Placement and substitution of variables
When adding variables to a report, they must be placed inside the “|” symbol. For example, to add the variable “name” to a report, the user must write it as follows:
|nombre|
Remember that the reports are made in Word format and then uploaded to the platform for later use.
It is important to note that table variables, which will be mentioned later, are special in that they must use the *
symbol instead of the |
symbol. For example: *nombre*
.
At the time of generating the report, the variables will be replaced with their corresponding values.
It is worth noting that if any variable does not have an assigned value on the platform, the variable's name will remain as is in the report, and the information will be generated without being processed.
Variable management
We have the option to format numeric variables using % to indicate the number of decimal places we want that variable to display when it is printed in the report.
|variable%2| → This means that the variable will be formatted with two decimal places.
Applying formatting using the % symbol to a formula variable will override the decimal specification defined at the time of its creation, as detailed below.
We can include text or image variables in the report that do not exist on the platform. When generating the report, the system will prompt us to manually fill in those variables.
Text Variables:
As the name suggests, these are variables that will be replaced with text. For example, a user may want to include the following variable in the report:
|variable-that-does-not-exist-in-the-platform|
Since the system cannot find a value for this variable (as it does not exist anywhere), the user will be prompted to provide a value when attempting to generate the report. The value provided by the user must be text.
Image Variables:
|variable-that-does-not-exist-in-the-platform@image|
As with text variables, the system will not be able to find a value for this variable because it does not exist. The user will be prompted to upload an image and assign it to the variable as its value when generating the report.
It is important to note the @image
at the end of the variable. If you want to use an image variable at runtime, you must add @image
at the end to indicate to the system that this is an image variable.
Default Variables:
On the platform, under the "Variable Management" section, you will find variables that are pre-created and grouped into different categories.
Offer variables
Simulation variables
These are variables that we will use to show the results of the simulations carried out in the client's report. Remember that we carry out the simulations through the web simulator or platform (client Wizard). These variables are distinguished because the structure of their name is usually, for example: simulation-surface
Client variables
These variables allow us to extract data from the client for whom we have generated the offer or simulation. Its name begins with client and is accompanied by the attribute, for example: client_name
Opportunity variables
By using these variables we can display the opportunity attributes, for example: opportunity_address. In addition, we can create dynamic opportunity fields that will also appear visible here.
Company variables
With these variables we can show the company attributes, for example: company_zipcode . In addition, we can create dynamic company fields that will also appear visible here.
In the "variable management" section you will find formula variables, which are generated by applying operations to existing variables. These variables are useful for obtaining specific data that we may need or want to show to our end customers.
Regarding formulas, you can use any variable as an operand. This includes all types of variables mentioned in the general section: dynamic field variables, profitability variables, simulation variables, execution variables, and even formula variables themselves.
An example of a formula would be:
|report_variable| + |dynamic_field_variable| - |profitability_variable|
To create a formula variable, click on "create new formula" at the top right and we are asked to fill in the following information:
Variable Type: This will be the type of the formula variable that is created.
Variable: Then choose the base variable on which we will perform the operation.
Include index: This option allows us to indicate which value within the dimensions of the variable we want to show. For example, we have the offer variable "total_savings_per_year" which has dimensions 25x1, which means that it contains 25 values that correspond to 25 years. In order for the system to know which year of those 25 we want to show, we choose the index when we create the formula.
Description: It is automatically filled in depending on the variable we select.
Add formula: In this field we must fill in the formula that we are going to create.
Variable name: We must fill in the name that we will give to the created variable.
Descriptive Name: The descriptive name of the variable will be the name used in the report to print the result of the formula. The characters allowed in this field are lowercase letters and the underscore.
Number of decimals: We must indicate how many decimals we want to be taken into account in this variable.
Operation result: Allows us to add a description that explains what the result obtained from the created formula consists of.Important: The formula will be resolved at the time the report is generated.
Important: The formula will be resolved at the time the report is generated.
In the formula the allowed operators are the following:
Arithmetic operators
Formula variables must be resolved as a single value. That said, when using profitability variables that are a collection of values, two scenarios can arise:
Scenario 1: Indexes are specified within the formula.
|total_savings_per_year$1| + |offer_total_price|
This formula should appear in the report as follows:
|my_formula|
Scenario 2: In this case, the indexes are not specified in the formula, but in the report itself, along with the alias.
For example, the formula would now look like this:
total_savings_per_year| + |offer_total_price|
In the report, the variable should appear as follows:
|myformula$1|
When using the second scenario, all collection variables within the formula must share the same dimensions. This ensures that when indexes are specified alongside the alias in the report, the variables are resolved in the same way, applying the same indexes.
Union operator
The union operator combines variables that are words into a single word. For example:
|client_name| . |company_name|
The concatenation operator should only be used with words, and no other type of operator can be present in the formula
Rounding operator
The rounding operator allows you to round a single number, a variable, or a group of variables. The final value of the arithmetic expression contained in the rounding method will be rounded to the nearest integer or decimal precision that is specified by adding a comma and the number of decimal places. For example:
round(|total_savings_per_year$1| + |offer_total_price|) => Round to the nearest integer
round(|total_savings_per_year$1| + |offer_total_price|,1) => Round to the first decimal place
round(|total_savings_per_year$1| + |offer_total_price|,2) => Round to the second decimal place
Artículos relacionados