What is variable?
Variable is a facility for storing data. The current value of the variable is the data actually stored in the variable. In NiceLabel variable can be used in many places: as a source of value for objects that are used as part of label design, in database filters, in functions and scripts. Variables allow you to design flexible and reusable labels.
What types of variables are there?
Depending on source of variable value there are several different types of variables in NiceLabel:
- Prompt variable
- Database variable
- System clock (date or time) variable
- Printer clock (date or time) variable
- Global variable
- Pick List
- Internal variable
- As you can see from the screenshot below you can distinguish them also by the icon in front of variable name.
Prompt variable is a variable that requires from user to enter or confirm its value before printing. This is the most used type of variables. Variables of this type can also be set from NiceForm, NiceWatch and NicePrint or from your own application if you are using NiceLabel SDK.
Database variable is variable that gets its value from database field. It is created automatically when user selects field from a database table.
System clock (date or time) variable
"System clock" variable is a variable that gets its value from the computer system clock. Because of this data format of such variable can only be date or time.
Printer clock (date or time) variable
"Printer clock" variable is similar to "System clock" variable but it gets its value from the thermal printer. If printer label is designed for does not support such functionality you will not be able to use it; it is not even available in the list of possible sources for variable.
Global variable is a variable that can be used on many different labels. Once it is defined, it is stored outside the current label so it is available for any other label as well. Its last value is stored even after closing the label file and exiting the application. This comes handy for example when continuing serial numbers from previous printing is required. Values of global variables are stored in GLOBALS.TDB file. You can find the file in the "C:\Documents and Settings\All Users\Application Data\EuroPlus\NiceLabel5\System" folder on Windows XP or in the "c:\Users\All Users\EuroPlus\NiceLabel 5\system" folder in Windows Vista and Windows 7. Global variable can only be created manually in the Variable dialog box. Make sure to select Global as the Source for the variable in the General tab. If you copy your label file, which uses global variables to another computer, you also have to copy GLOBALS.TDB file to the new computer. If you miss this step, then NiceLabel won’t find appropriate global variable and will notify you of this situation. At the same time a substitute global variable will be created, but last value of old variable will not be known, nor will the correct variable properties be restored. The same global variable is not limited for use on only one label. You can use it on as many labels as you like. Please note, that only one label, using the same global variable, can be printed at a time. When using global variables, they are locked for one label and this prevents more labels to use the same global variable at the same time.
When pick list is used as a source for variable you can define a list of values that can be used (no duplicates are allowed). No other values can be used or typed in before printing. This type is useful if you have a small set of possible values that variable can use.
Internal variable gets its value automatically and you can not modify their properties or values. You can only enable or disable them and of course connect them with different objects on the label. In current version of NiceLabel (22.214.171.12465) there are 11 internal variables (in alphabetical order):
- ComputerName: Contains the information about the name of the computer where labels are processed.
- CurrentBatchQuantity: Contains information about the label quantity in the current label batch. The value is reset at beginning of each batch in the printing process.
- DefaultPrinterName: Contains the name of the default printer on the system.
- EPCData: Contains EPC data that will be encoded in the RF tag. This variable contains data only if RFID is enabled.
- LabelFileName: Contains full name of the current label, including the path to the file.
- LabelPrinterName: Contains the name of the printer that is used on the label.
- RequestedQuantity: Contains the quantity of the labels as specified by the user or external application.
- ShortLabelName: Contains the name of the label without the path. Only filename with the extension is returned.
- SystemUserName: Contains the name of the Windows user that is logged in and is running the application.
- TotalQuantityPrinted: Contains the quantity of all unique labels printed. Label copies are not included in this variable, only the number of different labels is.
- UserName: Contains the name of the user that is logged in and is using the application. This variable contains value only when you have enabled user management in NiceLabel.
If you want to see these variables you have to enable them in the “Variables” dialog box (see screenshot above).