With PC-DMIS, you can load custom strings from a comma separated value (CSV) text file and display them inside of a customized label. This is very handy if you need custom strings displayed in a different language. To do this, just localize the csv file and provide it to the operator.
The Syntax
The USERSTRING function takes two parameters:
=USERSTRING(<expression1>,<expression2>)
The first parameter, Expression 1, is a string pathway that defines the location of the CSV file. This must be inside quotes. If the file cannot be found, due to an incorrect pathway or a lack of read permissions, the function returns, "File cannot be opened".
The second parameter, Expression 2, is the index number in the CSV file associated with the string of text to display. If the CSV file is accessible, but you specify an index number that doesn't exist in the CSV file, the function returns, "index not found".
The CSV File
The csv file must contain on an individual line: the unique index number, then the comma, and then the string.
To define multi-line strings, use the new line character (\n).
For example, consider this sample CSV file:
10,The universe is your playground.
1,Place the part on the table.
3,This is a \nMulti-line string.
...
230,"Bleeding Edge. Cutting Edge."
200,Circle 6001
201,5+5
Notice that the numbers preceding each string don't need to be sequential; they only need to be unique. Quotation marks and other characters will come through as typed in the CSV file. Numbers are not mathematically evaluated.
An Example
Suppose the above CSV file was stored in your d:\temp\ directory with a file name of MyStrings.csv. If you wanted to display four different custom strings in a label, your expressions in the cells of the GridControlObject on that label might look like this:
=USERSTRING("d:\temp\MyStrings.csv",1)
=USERSTRING("d:\temp\MyStrings.csv",3)
=USERSTRING("d:\temp\MyStrings.csv",230)
=USERSTRING("d:\temp\MyStrings.csv",201)
Your label, once evaluated would look like this: