A standard text block can contain variable data, such as a date, a name or a telephone number. Adding variables to your text is done in two steps:

  1. Creating the variables
  2. Inserting the variables to your text


This article will deal with step 1: creating the variables. In the article Variabelen in een tekstblok plaatsen you will read how to insert the variables in your text.


To create variables, first open the SmartPart or Document in question:

  1. Go to the side panel in Word.
  2. Click on the edit icon of the desired SmartPart or Document.


Now create the variables as follows:

  1. Make sure the Variables list is activated 
  2. Click on the +-icon at the bottom of the side panel


The following screen now appears:



Select the type of variable you wish to create.


Your options are:


  • Text: if the variable is a text, such as a name;
  • Date: if the variable concerns a date (please refer to Default format and Default value);
  • Yes/No: if the variable concerns a choice. This will place a check box on the input screen. When the user checks the box, a complete text block is placed; when the box is unchecked, the text block is removed.
  • Number (without comma/with comma);  
  • Currency: if the variable concerns an amount.


All types except for Yes/No result in a DB:TEXT variable. On the input screen this is represented by an edit box. The text the user enters in the edit box, is placed at the position of the variable.

The Yes/No type results in a DB:IF/END IF variable. This is a variable that encompasses a text block. On the input screen this is represented by a check box. 


After selecting the variable type, the following screen appears:

On the top of the windows these tabs are available: General, Value, List and Dialog.

The tab "List" is only available when the variable type is a Text variable.


Now you can fill the desired data in the correct fields of the tabs:


General

Name

Give the variable a name that is unique within the current SmartPart (or Template). The name may not contain any spaces or symbols like &-/, etc.


Description

You can put in a description in the field. On the dialog there will be an info-icon next to the inputfield. If the user clicks on this icon the description text will appear. This way you can give extra information on the usage of the variable.


Place on dialog

Activate this slider if you want the variable to be shown on the dialog. Note In some cases you may not wish to show the variable on the dialog, for example when you don't want the user to change the default value you entered in the Default value field.


Value

Hier staan 5 iconen voor de verschillende opties met betrekking tot de (standaard)waarde van de variabele.


Default value - Pencil

Here you can give the variable a default value for usage in the dialog. The user can choose to use this value or edit it to his or her needs. The default value has to be between quotes ("") like this: "John Doe".

If you use a date type it is advised to use the current date as default value. You can do this by typing: Today() (without the quotes).


Value - Abc

Here you can give the variable a basic value. This is just the value as it is. The value doesn't need to be between quotes (""):

John Doe


Expression - accolades

With this option selected you can use an expression to state the default value. This expression will me run when the document/dialog is started. The value from the expression is then put into the field of the dialog.

After the field is filled with the default value, the user can still change the value. When the dialog is executed to generate the document, the final value in this field will be used for the variable.


Variable - fx

When you use this there must me an expression given. This expression will me run at the start of the document/dialog. But this will again run when the dialog is executed to generate the document. The value will again be checked with the expression. Using this way to determine the value of the variable means the use can change it in the dialog, but it will revert to the valua of the expression as soon as the dialog is executed and the document generated. Because of this placing the variable on the dialog doesn't really have any added value.


Datascource - cilinder 

Here you can take a value from an available datasource.


Default format

This option only relates to the Date type variable and allows you to select the date format. The default is Medium date, e.g. 1 January 2019.



List

At this tab you can define the value of the variable from a list.

The options here are: "None", "Translations", "List", "Datascource"


None - circle with line

This defines the variable not using a list and is standard selected.


Translations - globe/A

This is used when the translations are used as a listing. The source of the translation needs to be typed in.


List - three dashes

With this function you can define your own list

There are 2 fields available to be filled in. The first field is shown in the dialog as a list. The values have to be seperated with a ";". Example: Male;Female;Unknown (this is a list that can be used to determine gender). The first value in this field is the one selected by default in the dialog. In this example it is "Male"


The second field is optional. Here you have the option to give keyvalues for the choices defined in the first field. The first value of the first field is connected to the first value of the second field. Example:

To use the keyvalues in the document as output you need to select the icon "fx" (more on this later in this article).



Datascource - cilinder

Here you can use a listing from a datasource.


Choosing the value and the why the value is selected on the dialog window

Below each question the options are shown.


Which value would you like to use?

The choice here is between the shown value in the dialog window and the keyvalue. The keyvalue can also be from the linked datascource if you are using this (cilinder icon). If the keyvalue is not being used then it is not needed to fill the second field of the value (see above).


How do you want the user to make a selection?

There are 3 options for making a selection when using a list.

The circle represents using a radiobutton for the selection.

The rectangle with the arrow represents a dropdown listing where the user can only choose between the available values.

The pencil also gives the use a dorpdown listing where the choices are represented, but the user can also type in the desired value without it being in the list of values.


Dialog


Display name

Enter the name to be used on the input screen (dialog). In the case of multilingual dialogs, you will use a translation for the display name. Use the following notation: @/folder/translation e.g. @/dialog/EmployeeName 


Order

Enter the order in which the current variable should appear on the dialog.


Depending fields

The yes/no fields give the option of making other variables dependent on their value: only when the yes/no field is checked, will the underlying variables b activated. Enter the name or names of the variables that should be made dependent on the current variable. Use comma's to separate the variable names, but no spaces


Is required

If the variable is required, activate this slider. If the user tries to complete the dialog without entering anything in this field, he will be prompted to do so.


Multiline input

If you turn this option on the field will be larger in height encompassing more lines of text.



----

See the below example for using depenting fields.


 

Here you see that the variables Name and Job title are greyed out as long as Second Signature has not been checked.


If you put the "!" before the depending fields you reverse the functionality.


Here you see that the variables Name and Job title are NOT greyed out as long as Second Signature has not been checked.

When it is checked they will become greyed out.


After completing the fields for the variable, click on Save. The new variable is now added to the list of variables.

In het artikel Variabelen in een tekstblok plaatsen lees je hoe je de variabelen vervolgens invoegt in je tekstblok.