Set - A function to create and manipulate variables and change fields values

The function Set allows the creation of new variables that will be treated as fields (mappings) and then change that variables values.
The new value passed to Set function can be plain text, an existing field (mapping) or a Javascript field.
In the case of templates having Static Sections, you can create new variables outside of said Static Sections and use those variables inside the same Static Sections.

Definition:

${set(<variable name>,<new value>)}
Expand to see the examples on sample code
Define a variable "count" with value "0" and then use it as a normal field.

${set(count,0)}  
${count} 
 
Define a variable "newKey" with the value of field ${Key} and then use it as a normal field.

${set(newKey,${Key})}  
${newKey}

Define a variable "TodayDate" with the value of the current date calculated with Javascript and then use it as a normal field

${set(TodayDate,%{(new Date()).getDate() + "/" + ((new Date()).getMonth()+1) + "/" + (new Date()).getFullYear()})} 
${TodayDate} 
 

Note

The function Set can be also used to change the value of existing fields (existing mappings), but in that case, it has a limitation: all occurrences of that field in the document will be replaced with the value of the latest set that is applied.

Note

The values of all the variables (mappings) created with the Set function and used on the header/footer of a template will correspond to the last value passed to the set function.  

Prop -  A function to set custom properties to be used by Xporter during the document generation

The main goal of this issue is to allow users to define properties that will be used later by Xporter during the document processing.

Usually, integrations require some extra configuration such as security tokens, API keys and other kind of configurations.

Specification

Function Nameprop
First ParameterKey
Second parameterValue

Notation

${prop(Key,Value)}

 

Example

${prop(my.first.property.key,qwerty12345)}
${prop(service.api.key,84f7970c-5f70-47d9-a4f2-c75151820ba0)}
${prop(service.api.username,userAdmin)}

Image Loader

This function basically loads an image from a URL and put that on the document. Also, you are able to specify the with and/or height of the images.

Definition: 

!{<URL>}


Below there are some example of its usage: 

or 

 To use the code below you need to check here how can you iterate that.

After export the document, the generated file is going to see this:



  • No labels