Working with Variable Conversion Process
Process Purpose
The "Variable Conversion" process is used to convert a string into another one but with a different format or encoding (from ASCI to hexadecimal or base 64 conversions).
Check the provided "Variable Conversion" examples at the end of the topic.
When you add a process, you are required to define its settings. This occurs in the process's properties window which is displayed automatically after having added the "Variable Conversion" process.
If any subsequent edition is required, double-click the process to open its properties window and enter the necessary modifications.
Fill in the following options:
Source Variable |
|
Variable |
Click to select the variable with the string to be converted. See Variable Usage. |
Type of conversion |
|
Conversion |
Select the type of conversion from the drop-down. Depending on the selected conversion type, the “Option” box may become available. |
Option |
Only available for some "Conversion" types. Select the appropriate option from the drop-down.
The use of the "RAW" option requires MCL-Client 4.10.P20 (or a higher version) and/or MCL-Simulator 4.9.23 (or a higher version).
In the case of "BASE64" Encoding or Decoding conversion, if you select "UTF-8 (Default)", the conversion will handle the source's data as follows:
•If the source's data are "RAW" (ex: a file in the device with unprocessed/unknown format), the conversion operation will consider them as being type "RAW". •If the data of the source are NOT "RAW" (ex: a string, a value in a variable), MCL-Client will interpret them as being "UTF-8" data. This can be very useful, for instance, to decode Base64 data strings into images. |
Store Result into Variable |
|
Result Variable |
Click to select the variable that will receive the converted result. See To Select/Create a Variable. |
If required, use the icon (upper right corner of the properties window) to attach any relevant notes to this process.
Click it and enter your notes in the resulting text box. These notes will be displayed in the corresponding "Actions" tab or "Process" window (in the "Notes" field) and in the "Developer Report".
After filling in the required options, click to conclude or to abort the operation.
The added process is displayed in the corresponding "Actions" tab or "Process" window.
Use the right-click in MCL-Designer's input boxes to access some related options as well as the general "Cut", "Copy"; "Paste"; "Search" actions (active/inactive according to the current context).
Ex: If you right-click the "Variable" input box (included in a "Conversion's" properties window), you are provided with general editing/search actions and other more specific options such as "Variable Select" (see "Variable Select"); "Variable Insert" (see "Variable Insert"); "Insert Special Character" (see To Insert Special Characters into a Control's Text Input Field) and "Localization Select" (see Localization List).
If you right-click another input box, it may provide other possibilities.
String |
Conversion Type |
Option |
Result |
123 |
Character to ASCII value (or sum of ASCII values |
N/A |
150 |
123 |
ASCII value to one character |
N/A |
{ |
123 |
Number to 2 Hexadecimal digits string |
N/A |
7B |
123 |
Number to 4 Hexadecimal digits string |
N/A |
007B |
123 |
Hexadecimal string to decimal number |
N/A |
291 |
BART |
BASE64Enc(ode) |
UTF-8 (Default) |
QkFSVA== |
BART |
ANSI |
QkFSVA== |
|
QkFSVA== |
BASE64Dec(ode)QkFSA== |
UTF-8 (Default) |
BART |
QkFSVA== |
ANSI |
BART |
|
010110 |
From Binary |
To Octal |
26 |
123 |
From Octal |
To Hexadecimal |
53 |
123 |
From Decimal |
To Binary |
111011 |
123 |
From Hexadecimal |
To BCD-4 bits |
123 |
123 |
From BCD-4 bits |
To Binary |
000100100011 |
123 |
From BCD-6 bits |
To Octal |
010203 |