Formula Function Reference
Below is a list of all functions available for use with the EDS Formula Evaluator, along with descriptions and expected parameters.
Some functions may behave differently depending on the module that they are being used with. Some functions may not be available in all modules.
Function Definition Notation
Parameter Types
In the function descriptions below, each parameter will be followed by a type in subscript:
- str: Text string.
- int: Integer (whole number).
- fp: Floating point (decimal number).
If the value entered (or returned from a nested function) is not the expected type for the parameter, the Formula Evaluator will automatically convert it to the expected type.
Optional Parameters
In the function descriptions below, parameters surrounded by square brackets [] are optional.
Parameter lists ending in a triple period ... mean an arbitrary number of additional parameters can be supplied.
Text Manipulation Functions
FIND
FIND(haystackstr, needlestr [, instanceint])
Finds the first instance (or 1-based instance, if specified) of needle in haystack, and returns the 1-based character position of the start of needle. If instance is negative, searches backwards from the end of haystack.
Returns 0 if needle was not found in haystack.
The search is case-sensitive.
See also: FINDEND.
Example | Result |
---|---|
FIND("01-CV101-A", "01") | 1 |
FIND("01-CV101-A", "01", 2) | 7 |
FIND("01-CV101-A", "01", -1) | 7 |
FIND("01-CV101-A", "B") | 0 |
Available from: 8.8.1.0.
FINDEND
FINDEND(haystackstr, needlestr [, instanceint])
Finds the first instance (or 1-based instance, if specified) of needle in haystack, and returns the 1-based character position of the first character after the end of needle. If instance is negative, searches backwards from the end of haystack.
Returns 0 if needle was not found in haystack.
The search is case-sensitive.
See also: FIND.
Example | Result |
---|---|
FINDEND("01-CV101-A", "01") | 3 |
FINDEND("01-CV101-A", "01", 2) | 9 |
FINDEND("01-CV101-A", "B") | 0 |
Available from: 8.8.1.0.
INC
INC(valuestr, countint)
Increments the last alpha sequence of characters, or numeric sequence of characters, in value, by count (which can be negative to decrement).
Returns the incremented result.
See also: NSQINC.
Example | Result |
---|---|
INC("CV-101", 11) | "CV-112" |
INC("CV-101", -11) | "CV-090" |
INC("(1BB)", 27) | "(1CC)" |
INC("(1BB)", -27) | "(1AA)" |
Available from: 24.01.00.
LEFT
LEFT(inputstr, countint)
Returns the left-most count characters from the input text string.
Example | Result |
---|---|
LEFT("CV101", 2) | "CV" |
LEFT("CV101", 3) | "CV1" |
LEFT("CV101", 10) | "CV101" |
Available from: 8.8.0.0.
LEN
LEN(inputstr)
Returns the count of Unicode characters in the input text string.
Example | Result |
---|---|
LEN("CV101") | 5 |
LEN("Café") | 4 |
LEN("Кириллица") | 9 |
Available from: 8.8.0.0.
LOWER
LOWER(inputstr)
Converts the input string to lower-case.
Supports text from the following Unicode blocks: ASCII/Basic Latin, Latin-1 Supplement, Latin Extended-A, Cyrillic.
See also: UPPER.
Example | Result |
---|---|
LOWER("ABC") | "abc" |
LOWER("CAFÉ") | "café" |
LOWER("КИРИЛЛИЦА") | "кириллица" |
Available from: 8.8.0.0.
MID
MID(inputstr, firstint [, countint])
Returns a substring from the middle of input, starting from first (1-based character position), and count characters long (or to the end of input if count is omitted).
Example | Result |
---|---|
MID("01-CV101-A", 4) | "CV101-A" |
MID("01-CV101-A", 4, 5) | "CV101" |
MID("01-CV101-A", 8, 5) | "1-A" |
Available from: 8.8.0.0.
REPLACE
REPLACE(inputstr, oldstr, newstr [, instanceint])
If instance is omitted (or zero), replaces all instances of old with new in the input text string.
If instance greater than zero, replaces the specified instance (1-based, from the start of the string) of old with new.
If instance less than zero, replaces the specified instance (1-based, from the end of the string) of old with new.
This function is case-sensitive.
Example | Result |
---|---|
REPLACE("01-CV101-A", "1", "2") | "02-CV202-A" |
REPLACE("01-CV101-A", "1", "2", 2) | "01-CV201-A" |
REPLACE("01-CV101-A", "1", "2", -1) | "01-CV102-A" |
Available from: 8.8.1.0.
RIGHT
RIGHT(inputstr, countint)
Returns the right-most count characters from the input text string.
Example | Result |
---|---|
RIGHT("CV101", 2) | "01" |
RIGHT("CV101", 3) | "101" |
RIGHT("CV101", 10) | "CV101" |
Available from: 8.8.0.0.
SPLIT
SPLIT(inputstr, delimiterstr [, indexint])
Splits a text string into substrings, and returns the substring at the specified index (or a count of substrings if no index was specified).
Leading and trailing spaces in the returned substring will be automatically trimmed.
Parameter | Description |
---|---|
input | The string to split. |
delimiter | A string of one or more characters, that when encountered, signals the end of the preceding substring, and the start of the next (the delimiter string itself will be omitted from the substrings). If an empty string is supplied, substrings will be created from sequences of the same class of character (digit, alphabet letter, or other). |
index | 1-based index of the substring to return. If omitted, the count of substrings is returned. |
Example | Result |
---|---|
SPLIT("01-CV101-A", "-", 2) | "CV101" |
SPLIT("01-CV101-A", "-", -1) | "A" |
SPLIT("01-CV101-A", "-") | 3 |
SPLIT("01-CV101-A", "", 3) | "CV" |
Available from: 8.8.0.0 (empty string delimiter from 8.8.1.0)
STR
STR(numberfp [, precisionint [, widthint]])
Converts a number to a text string, with the specified precision and width.
Parameter | Description |
---|---|
number | The number to convert. |
precision | The number of digits after the decimal point to include in the resulting string. Rouding will be used. Padding zeros will be appending if required. If precision is zero, the decimal point will be omitted. If precision is omitted, all significant digits after the decimal point will be included, and trailing zeros will be trimmed. |
width | If specified, the number of digits (including the decimal point, if present) to include the resulting string. If width is larger than the output, the string will be padded with leading zeros. |
Example | Result |
---|---|
STR(12.3456000) | "12.3456" |
STR(12.3456, 2) | "12.35" |
STR(12.3456, 7) | "12.3456000" |
STR(12.3456, 2, 7) | "0012.35" |
STR(12.3456, 0, 5) | "00012" |
Available from: 8.8.1.0.
UPPER
UPPER(inputstr)
Converts the input string to upper-case.
Supports text from the following Unicode blocks: ASCII/Basic Latin, Latin-1 Supplement, Latin Extended-A, Cyrillic.
See also: LOWER.
Example | Result |
---|---|
UPPER("abc") | "ABC" |
UPPER("Café") | "CAFÉ" |
UPPER("Кириллица") | "КИРИЛЛИЦА" |
Available from: 8.8.0.0.
Aggregation Functions
CONCAT
CONCAT(input_astr, input_bstr [, ...str])
Concatenates the input strings together.
Example | Result |
---|---|
CONCAT("CV", 101) | "CV101" |
CONCAT("01", "-", "CV101", "-", "A") | "01-CV101-A" |
Available from: 8.8.0.0.
JOIN
JOIN(delimiterstr, input_astr, input_bstr [, ...str])
Joins all of the input strings together, separating each with delimiter.
See also: JOINNB, CONCAT, SPLIT.
Example | Result |
---|---|
JOIN(" ", "CV", 101) | "CV 101" |
JOIN("-", "01", "CV101", "A") | "01-CV101-A" |
Available from: 8.8.0.0.
JOINNB
JOINNB(delimiterstr, input_astr, input_bstr [, ...str])
Joins all of the non-blank input strings together, separating them with delimiter.
Example | Result |
---|---|
JOINNB(" ", "CV", 101, "", "A") | "CV 101 A" |
JOINNB("-", "", "01", "", "CV101", "A") | "01-CV101-A" |
Available from: 8.8.1.0.
NONBLANK
NONBLANK(indexint, input_astr, input_bstr [, ...str])
Returns the input parameter at index (1-based), ignoring blank values.
If index is negative, counts back from the end of the input values instead.
See also: JOINNB.
Example | Result |
---|---|
NONBLANK(1, "", "", "A", "", "B", "C", "", "", "D") | "A" |
NONBLANK(2, "", "", "A", "", "B", "C", "", "", "D") | "B" |
NONBLANK(-1, "", "", "A", "", "B", "C", "", "", "D") | "D" |
NONBLANK(-2, "", "", "A", "", "B", "C", "", "", "D") | "C" |
Available from: 8.8.1.0.
Lookup and Reference Functions
GET
GET(varpart1str [, varpart2str [, ...str]]
Concatenates all the provided variable name parts (as if varpart1, varpart2, ... were passed to CONCAT), then uses the resulting variable name to perform a lookup into:
- Variables saved using SET/GETSET (if supported), returning last value assigned to the variable name. If unsupported, or the named variable has not been set (or was UNSET), falls back to performing a lookup into:
- Source data, returning the value (if any) fetched from the field/column/etc that matches the variable name (effectively providing an indirect alternative to the [source] syntax).
Order of Evaluation | Example | Result | Notes |
---|---|---|---|
1 | [T3] | "1" | Fetches and returns the value from the 'T3' variable (if previously set), or the 'T3' field in the source data, using source data expression syntax. For this example, nothing has previously set the 'T3' variable, so assume that there is a 'T3' field in the source data with a value of "1". |
2 | GET("T", STR(1 + 2)) | "1" | GET concatenates "T" with the result of STR(1 + 2), to produce "T3", then fetches and returns the value from a variable with this name (if previously set), or from the field in the source data with this name. The result is thus the same as the previous formula. |
3 | SET("T", STR(0 + 3), "6") | "6" | SET concatenates "T" with the result of STR(0 + 3), to produce "T3", then sets the value of the 'T3' variable to "6", and returns the value that was set (ie "6"). |
4 | GET("T3") | "6" | As the previous formula set the 'T3' variable to "6", returns "6" (even if there was a 'T3' field in the source data that had a difference value, as was shown with the 1st and 2nd formulae). |
5 | [T3] | "6" | Equivalent to the previous formula, and thus also returns "6". |
Available from: 24.01.00.
LOOKUP
LOOKUP(input_keystr, default_valuestr, key_astr, value_astr [, key_bstr, value_bstr [, ...]])
Searches for input_key amongst key_a, key_b, ..., key_z (case sensitive), and if a matching key is found, returns the corresponding value.
If a match was not found, default_value will be returned.
See also: MAPLOOKUP.
Example | Result |
---|---|
LOOKUP("PT", "Unknown", "FT", "Flow", "PT", "Pressure", "TT", "Temperature") | "Pressure" |
LOOKUP("LT", "Unknown", "FT", "Flow", "PT", "Pressure", "TT", "Temperature") | "Unknown" |
Available from: 8.8.2.0.
MAPLOOKUP
MAPLOOKUP(return_fieldstr, lookup_tablestr, lookup_field_astr, lookup_value_astr [, lookup_field_bstr, lookup_value_bstr [, ...]])
Returns a value from return_field from a record in lookup_table (typically a DBF), where the record is found by matching lookup_value_a to lookup_field_a, lookup_value_b to lookup_field_b, and so on, for all specified fields and values.
The value in return_field may also be a formula itself (in hash pair format), in which case it will be evaluated, and the result returned.
See also: LOOKUP.
Example | Result | Notes |
---|---|---|
MAPLOOKUP("RATING", "TypeCodeToRatingTable.dbf", "CODES", "FT", "CLASSES", "Coriolis") | "Instrument_Flow_Transmitter_Coriolis" | Example usage in IM Import. DBF file found in IMP_IM\ImportMapFiles or MET_IM\ImportMapFiles |
The functionality of MAPLOOKUP varies depending on the process it is being used in:
Process | lookup_table location | Handling of blank fields present in lookup_table | lookup_value matching method | |
---|---|---|---|---|
lookup_field_a | Subsequent lookup_fields | |||
Instrument Manager/Cable Scheduler Import Map File |
| Map Record Ignored | Treated as a wildcard (*) Will match any corresponding lookup_value. | Exact match preferred, followed by case-insensitive Specmatch. |
Database Editor Compute Values |
| Blanks allowed and treated as blanks. Will only match a corresponding blank lookup_value. | ||
Elecdes/Paneldes Database Import | MAPLOOKUP not currently supported. | |||
Protogen |
Available from: 8.8.0.0 (return_field supporting a formula from 8.8.1.0).
MFGCODE
MFGCODE(mfg_namestr)
Searches for mfg_name in the Catalog manufacturer list, and if a record is found, returns the corresponding manufacturer code.
If a match was not found, mfg_name will be returned.
See also: MFGNAME.
Example | Result |
---|---|
MFGCODE("Rosemount") | "RM" |
MFGCODE("Allen-Bradley") | "2" |
Available from: 8.9.4.0.
MFGNAME
MFGNAME(mfg_codestr)
Searches for mfg_code (ignoring any sub-catalog suffix) in the Catalog manufacturer list, and if a record is found, returns the corresponding manufacturer name.
If a match was not found, mfg_code will be returned.
See also: MFGCODE.
Example | Result |
---|---|
MFGNAME("RM") | "Rosemount" |
MFGNAME("2") | "Allen-Bradley" |
Available from: 8.9.4.0.
NSQINC
NSQINC(valuestr, countint, keystr)
NSQINC(valuestr, countint, attributestr, classstr [, blockstr])
Increments value, count times, using the name sequence from the current project that best matches the provided key, or attribute/class/block.
key, attribute, class, and (if specified) block, are matched against the KEY, ATTRIBUTE, CLASS, and BLOCK1...40 columns respectively, in the name sequence file of the current project.
If value is blank, the first increment will be used get the initial value, rather than incrementing.
Returns the incremented result.
See also: INC.
Example | Result |
---|---|
NSQINC("S123", 1, "Tagname", "Device", "SW") | "S124" |
NSQINC("", 2, "Tagname", "Instrument", "in_afm") | "FT-002" |
NSQINC("", 1, "Wire_HV") | "H1" |
NSQINC("", 1, "Tagname", "Core", "4P") | "1wh" |
NSQINC("", 2, "Tagname", "Core", "4P") | "1bk" |
NSQINC("", 3, "Tagname", "Core", "4P") | "2wh" |
Available from: 24.01.00.
Logical Functions
AND
AND(input_astr, input_bstr [, ...str])
Returns 1 if all of the input parameters evaluate to a representation of "true" (a non-zero number, or a string that matches one of TRUE, T, YES, or Y, case-insensitive).
Otherwise, returns 0.
Example | Result |
---|---|
AND("FALSE", 1) | 0 |
AND("TRUE", "Y", "01") | 1 |
Available from: 8.8.2.0.
EQ
EQ(input_astr, input_bstr)
Returns 1 if input_a is the same as input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
Example | Result |
---|---|
EQ("2.0", "02") | 1 |
EQ("2.0", 2) | 1 |
EQ("2 a", 2) | 0 |
EQ("2 a", "2 A") | 0 |
Available from: 8.8.2.0.
GT
GT(input_astr, input_bstr)
Returns 1 if input_a is greater than input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
Example | Result |
---|---|
GT("10", 9) | 1 |
GT("10a", "9a") | 0 |
GT("B", "C") | 0 |
GT("FT20", "FT101") | 1 |
Available from: 8.8.2.0.
GTE
GTE(input_astr, input_bstr)
Returns 1 if input_a is greater than or equal to input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
See also: IF, EQ, GT, LT, LTE.
Available from: 8.8.2.0.
IF
IF(conditionstr, result_if_truestr [, result_if_falsestr])
Returns result_if_true if condition evaluates to a representation of "true" (a non-zero number, or a string that matches one of TRUE, T, YES, or Y, case-insensitive).
Otherwise, returns result_if_false (or an empty string if result_if_false is not supplied)
See also: EQ, NEQ, GT, GTE, LT, LTE.
Example | Result |
---|---|
IF(1, "On", "Off") | "On" |
IF("Y", "Good", "Bad") | "Good" |
IF("TT", 1, 0) | "0" |
IF("0", "Details") | "" |
Available from: 8.8.2.0.
LT
LT(input_astr, input_bstr)
Returns 1 if input_a is less than input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
Example | Result |
---|---|
LT("10", 9) | 0 |
LT("10a", "9a") | 1 |
LT("B", "C") | 1 |
LT("FT20", "FT101") | 0 |
Available from: 8.8.2.0.
LTE
LTE(input_astr, input_bstr)
Returns 1 if input_a is less than or equal to input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
See also: IF, EQ, GT, GTE, LT.
Available from: 8.8.2.0.
NEQ
NEQ(input_astr, input_bstr)
Returns 1 if input_a is not the same as input_b.
Otherwise, returns 0.
A numeric comparison is performed if both input strings can be interpreted as numbers (with no extraneous text). Otherwise, a case-sensitive textual comparison is performed.
Example | Result |
---|---|
NEQ("2.0", "02") | 0 |
NEQ("2.0", 2) | 0 |
NEQ("2 a", 2) | 1 |
NEQ("2 a", "2 A") | 1 |
Available from: 8.8.2.0.
NOT
NOT(inputstr)
Returns 0 if the input parameter evaluates to a representation of "true" (a non-zero number, or a string that matches one of TRUE, T, YES, or Y, case-insensitive).
Otherwise, returns 1.
Example | Result |
---|---|
NOT("2.0") | 0 |
NOT("F") | 1 |
Available from: 8.8.2.0.
OR
OR(input_astr, input_bstr [, ...str])
Returns 1 if any of the input parameters evaluate to a representation of "true" (a non-zero number, or a string that matches one of TRUE, T, YES, or Y, case-insensitive).
Otherwise, returns 0.
Example | Result |
---|---|
OR("FALSE", 0) | 0 |
OR("2.0", "N", 0) | 1 |
Available from: 8.8.2.0.
SPECMATCH
SPECMATCH(inputstr, spec_astr [, spec_bstr [, ...str]])
Returns the 1-based index of the first Specmatch spec that matches against input.
If input did not match any spec, returns 0.
Example | Result |
---|---|
SPECMATCH("FT101", "PT*", "FT*", "TT*") | 2 |
SPECMATCH("CV101", "PT*", "FT*", "TT*") | 0 |
Available from: 8.8.2.0.
State Persistence Functions
Note: These functions allow one formula to save one or more values when evaluated, that can then be recalled by a subsequent formula when evaluated (see GET, Source Data Expressions), thus allowing state persistence and limited programmability in certain processes that evaluate multiple formulae in a deterministic order.
The following processes support state persistence:
Processes supporting persistence | Duration of persistence | Order of formula evaluation | Available from |
---|---|---|---|
IM/CS Import Data | Until the end of the current Import process | For each record in the Import source data:
| 24.01.00 |
Various grid editors: Compute Values | Until the end of the current Compute Values invocation | For each row in the grid selection, from top to bottom:
|
ARRAYADDRECORD
ARRAYADDRECORD(varpart1str [, varpart2str [, ...str]])
Available only in Import Map Files.
Concatenates all the provided variable name parts, then adds a reference to the current destination record (whether being created or updated) to the end of the array with that variable name. Primarily used to set up for a subsequent ARRAYSORT.
Equivalent to SETRECORD(varparts..., SET(varparts..., "Count", GET(varparts..., "Count") + 1)).
The number of elements in an array can be obtained using GET(varparts..., "Count").
Individual elements in an array can be obtained using GET(varparts..., n), where n evaluates to an integer between 1 and the number of elements (inclusive).
Returns an empty string.
Note: An existing array can be truncated (as far as ARRAYADDRECORD and ARRAYSORT are concerned) by modifying or unsetting the "Count" variable with the same array name prefix (for example SET(varparts..., "Count", n), or UNSET(varparts..., "Count")). This will not unset any previously set array element variables (still retrievable by GET(varparts..., n)), but will cause ARRAYSORT to ignore them, and subsequent use of ARRAYADDRECORD to overwrite them.
See also: ARRAYSORT, GET, SETRECORD.
Available from: 24.01.00.
ARRAYSORT
ARRAYSORT(varpart1str [, varpart2str [, ...str]], sortValueExprfunc, comparatorExprfunc)
Available only in Import Map Files.
Concatenates all the provided variable name parts and obtains the array with that variable name, then sorts that array.
The sort is performed by first obtaining a "sort value" for each array element, by evaluating sortValueExpr for each array element - sortValueExpr can reference the array element using the val variable name, eg [val] or GET("val").
If an array element is a record identifier (saved by ARRAYADDRECORD or SETRECORD etc), relational data can be obtained by appending the relational column, eg [val:P1:Tagname].
After a sort value is obtained for each element, the array of pairs of { element, sortvalue } are sorted by evaluating comparatorExpr when two pairs need to be compared to determine order - comparatorExpr can reference both the sort values (using variable names sv1 and sv2) as well as the original array element values (using variable names v1 and v2), and should return non-zero (eg 1) if the first element (v1/sv1) is less than (ie should come before) the second element (v2/sv2), or otherwise should return 0.
Individual elements in the now sorted array can be obtained using GET(varparts..., n), where n evaluates to an integer between 1 and the number of elements (inclusive).
Returns the concatenated array variable name.
Note: Typically only useful in conjuction with specially constructed map sections that use Import Map File Control Flow Functions to iterate over the sorted results (and create/update records based on them) after having processed a block of (or all) source records.
See also: ARRAYADDRECORD.
Example | Notes |
---|---|
ARRAYSORT("_Panels", [val:Description], LT([sv1], [sv2])) | Assuming multiple Panel tag records have been added to the "_Panels" array beforehand by ARRAYADDRECORD("_Panels"), this will sort the Panel tag records alphanumerically (smallest to largest) by the "Description" values in their tag records. |
Available from: 24.01.00.
GETSET
GETSET(varpart1str [, varpart2str [, ...str]], valuestr)
Combines the functionality of GET to return the last assigned value of a variable (or the corresponding named value from the source data, if the variable has never previously been set or was UNSET), and SET to set the variable to the new value.
Returns the previously assigned value of the variable (or source data value) as per GET, rather than the new value (as per SET).
Order of Evaluation | Example | Result | Notes |
---|---|---|---|
1 | [T3] | "" | Shows that 'T3' is currently blank (either an empty 'T3' variable, or if no 'T3' variable, and empty or non-existing 'T3' source data field). |
2 | GETSET("T", STR(1 + 2), "6") | "" | Gets the value of 'T3' (like the first formula), then sets the value of the 'T3' variable to "6". |
3 | GET("T", STR(0 + 3)) | "6" | Gets the value of 'T3' (like the first formula), now returning the value "6" (set by the second formula). |
4 | GETSET("T", STR(1 + 2), "8") | "6" | Gets the value of 'T3' (like the third formula), then sets the value of the 'T3' variable to "8". |
5 | [T3] | "8" | Gets the value of 'T3', now returning the value "8" (set by the fourth formula). |
Available from: 24.01.00.
SET
SET(varpart1str [, varpart2str [, ...str]], valuestr)
Concatenates all the provided variable name parts (as if varpart1, varpart2, ... were passed to CONCAT), then assigns value to the variable name, which can subsequently be retrieved by GET, or a Source Data Expression specifying the same variable name.
If the variable name matches a source data field name, subsequent use of GET, GETSET, or Source Data Expressions specifying the source data field name will return the variable value in preference to the source data value (until such time as the variable is UNSET).
Returns value.
Order of Evaluation | Example | Result | Notes |
---|---|---|---|
1 | SET("T", STR(1 + 2), "6") | "6" | SET concatenates "T" with the result of STR(1 + 2), to produce "T3", then sets the value of the 'T3' variable to "6", and returns the value that was set (ie "6"). |
2 | GET("T", STR(0 + 3)) | "6" | GET concatenates "T" with the result of STR(0 + 3), to produce "T3", then fetches and returns the value from a variable with this name, returning the "6" set by the first formula (even if there was a source data field of the same name that had a different value) |
3 | [T3] | "6" | Gets the value of 'T3' (equivalent to the previous formula). |
4 | SET("T3", INC([T3], 2)) | "8" | Sets the value of the 'T3' variable to the previous value of 'T3' ("6"), incremented by 2 ("8"), and returns the result ("8"). |
5 | [T3] | "8" | Gets the value of 'T3', now returning the value set by the fourth formula ("8"). |
Available from: 24.01.00.
SETRECORD
SETRECORD(varpart1str [, varpart2str [, ...str]])
Available only in Import Map Files.
Concatenates all the provided variable name parts (as if varpart1, varpart2, ... were passed to CONCAT), then assigns the database record that the current Import Map section is creating/updating to the variable name, which can be retrieved in a subsequent map section as a string in the form "<IDX>,<Tablename>" by GET, or a Source Data Expression specifying the same variable name.
If the map section in which the variable value is assigned contains a MustBeNew condition, and that condition is not met, then a blank string will be assigned to the variable, instead of the existing database record.
If the variable value is retrieved before the end of the map section in which is it assigned, the result will be a blank string.
The typical use is to be able to directly specify the database record from an earlier map section as a related record for a subsequent map section (for example, specifying the parent record of a child record), without needing multiple mappings to fully define each relation. The variable name can also be used to directly specify the record for a subsequent map section to update. The variable name can also be used as the first relationship code in a relational column specification, which when used in FIELD will fetch data from the specified record.
Returns an empty string.
Consider the following Import Map File example, that is importing a cable connected to a device in a panel in an area:
ITEM_NUM | DESTFIELD | FIELD | COMP_TYPE | Notes |
---|---|---|---|---|
10 | Tagname | Area Name | Area | Find/create the area by name |
10 | #SETRECORD("_Area")# | Remember the found/created record as '_Area' | ||
20 | P1: | _Area | Find the panel by name that has the parent as the '_Area' record, or Create the panel and set the parent as the '_Area' record. | |
20 | Tagname | Panel Name | Enclosure | |
20 | #SETRECORD("_Panel")# | Remember the found/created record as '_Panel' | ||
30 | P1: | _Panel | Find the device by name that has the parent as the '_Panel' record, or Create the device and set the parent as the '_Panel' record. | |
30 | Tagname | Device Name | Device | |
30 | #SETRECORD("_Device")# | Remember the found/created record as '_Device' | ||
40 | Tagname | C-#_Device:Tagname# | Cable | Find/create the cable by name, using the tagname from the '_Device' record, prefixed with "C-" |
40 | C1: | _Device | Set the cable's first termination as the '_Device' record |
Available from: 24.01.00.
UNSET
UNSET(varpart1str [, varpart2str [, ...str]]
Concatenates all the provided variable name parts (as if varpart1, varpart2, ... were passed to CONCAT), then unassigns any value previously assigned to the variable name.
Returns the value previously assigned to the variable (or an empty string if the variable had no assigned value).
Useful to regain access to a source data parameter if SET was previously used to assign a value to a variable of the same name.
Order of Evaluation | Example | Result | Notes |
---|---|---|---|
1 | [T3] | "1" | For this example, nothing has previously set the 'T3' variable, so assume that there is a 'T3' field in the source data with a value of "1". |
2 | SET("T", STR(1 + 2), "6") | "6" | Sets the 'T3' variable to "6". |
3 | [T3] | "6" | Gets 'T3', showing that the variable value ("6") is returned in preference to any value in the 'T3' field in the source data ("1"). |
4 | UNSET("T", STR(0 + 3)) | "6" | Unsets the 'T3' variable, returning the last assigned value ("6"). |
5 | UNSET("T3") | "" | Does nothing (returning and empty string), as the 'T3' variable no longer exists (was unset by the previous formula). |
6 | [T3] | "1" | Gets 'T3', showing that the value in the 'T3' field in the source data is returned ("1"), now that there is no 'T3' variable. |
Available from: 24.01.00.
Import Map File Control Flow Functions
Note: These functions have intentional side-effects that manipulate aspects of the import map file processing when they are evaluated.
LOGMSG
LOGMSG(msgpart1str [, msgpart2str [, ...str]])
Available only in Import Map Files.
Concatenates the supplied message string(s) and writes the result to the import log file with a log entry type of "USER".
Typically used to aid in debugging while developing complex import map files.
Returns an empty string.
Available from: 24.01.00.
REPEATSECTIONS
REPEATSECTIONS(sections_to_repeatint)
Available only in Import Map Files.
Sets the next map file section to execute to be the section (sections_to_repeat - 1) before the current section, in effect causing the last sections_to_repeat (including the current section) to be executed again.
For example:
- REPEATSECTIONS(2) will set the next section to execute to be section before the current section.
- REPEATSECTIONS(1) will set the next section to execute to be the current section.
- REPEATSECTIONS(0) will set the next section to execute to be the section after the current section (ie normal behaviour).
Typically used to cause one or more sections to be executed multiple times, in conjuction with the use of variables, to create or modify child components when the source record only describes a parent component.
Returns an empty string.
See also: SKIPSECTIONS, SETNEXTSECTION.
Available from: 24.01.00.
SETNEXTSECTION
SETNEXTSECTION(item_numstr)
Available only in Import Map Files.
Sets the map file section to execute to be the section whose ITEM_NUM matches item_num. If there is no section matching item_num, no further sections will be processed against the current source record.
Typically used to cause one or more sections to be executed multiple times, in conjuction with the use of variables, to create or modify child components when the source record only describes a parent component.
Returns an empty string.
See also: REPEATSECTIONS, SKIPSECTIONS.
Consider the following Import Map File example, that is importing a terminal strip record from the source, and creating the number of terminals specified by the source-record:
ITEM_NUM | DESTFIELD | FIELD | COMP_TYPE | Notes |
---|---|---|---|---|
10 | Tagname | Strip Name | Terminal Strip | Find/create the strip by name |
10 | #SETRECORD("_Strip")# | Remember the found/created record as '_Strip' | ||
10 | #SET("Terms Remaining", [Terminals])# | Initialise a variable to track how many terminals remaining to find/create. | ||
10 | #SET("Term Name", [First Term])# | Initialise a variable to track the next terminal name. | ||
20 | >0 | #STR([Terms Remaining])# | Condition to only process the section if there are still some terminals remaining to find/create. | |
20 | P1: | _Strip | Find the terminal by name that has the parent as the '_Strip' record, or Create the terminal and set the parent as the '_Strip' record. | |
20 | Tagname | #GETSET("Term Name", INC([Term Name], 1))# | Terminal | Use the current value of the terminal name variable to name the terminal, and update the variable with the next terminal name. |
20 | #SET("Terms Remaining", [Terms Remaining] - 1)# | Decrement the count of terminals remaining | ||
20 | #SETNEXTSECTION("20")# | Evaluate this section again (until the conditional mapping [terms remaining > 0] evaluates to false) |
Available from: 24.01.00.
SKIPSECTIONS
SKIPSECTIONS(sections_to_skipint)
Available only in Import Map Files.
Sets the next map file section to execute to be the section (sections_to_skip + 1) after the current section, in effect causing the next sections_to_skip to not be evaluated.
For example, if the sections in the map file are { A, B, C, D, ... }, and the current section is A:
- SKIPSECTIONS(0) will set the next section to execute to be section B (ie normal behaviour).
- SKIPSECTIONS(1) will set the next section to execute to be section C (B skipped).
- SKIPSECTIONS(2) will set the next section to execute to be section D (B and C skipped).
Returns an empty string.
See also: REPEATSECTIONS, SETNEXTSECTION.
Available from: 24.01.00.
Output Formatting Functions
Note: These functions allow the formatting of a formula result (beyond the standard single line of plain text) in certain outputs.
NL
NL()
Returns a new line string that will create a line-break in the output, if the output supports line-breaks. Otherwise, returns a single space (" ").
Outputs supporting line-breaks | Corresponding formula location supporting NL() | Available from |
---|---|---|
IM/CS Connection Preview: Component Detail Text | [Preview Detail Text Formula] column in the Folder Settings Editor, or the Set Naming Formulae dialog. | 24.00.00 |
IM/CS Datasheets | Datasheet template cells |
DWG Manipulation Functions
Note: These functions have intentional side-effects that manipulate aspects of the containing DWG file when they are evaluated, and are thus only available in the specified scenarios.
CL_LAYERON
CL_LAYERON(layer_astr [, layer_bstr [, ...str]])
Available only on Custom Loop templates.
Ensures each specified layer is turned on in the generated loop.
Returns an empty string.
Available from: 8.8.2.0.
CL_LAYEROFF
CL_LAYEROFF(layer_astr [, layer_bstr [, ...str]])
Available only on Custom Loop templates.
Ensures each specified layer is turned off in the generated loop.
Returns an empty string.
Available from: 8.8.2.0.
CL_LAYERDEL
CL_LAYERDEL(layer_astr [, layer_bstr [, ...str]])
Available only on Custom Loop templates.
Deletes each specified layer (and all entities on that layer) in the generated loop.
Returns an empty string.
Available from: 8.8.2.0.
CL_LAYERMOVE
CL_LAYERMOVE(layer_astr, x_translation_afp, y_translation_afp [, layer_bstr, x_translation_bfp, y_translation_bfp [, ...]])
Available only on Custom Loop templates.
Moves all the entites on layer_a by { x_translation_a, y_translation_a } (in DWG units) on the XY plane, and so on for subsequent layers and translations provided.
Returns an empty string.
Available from: 8.8.2.0.
CL_LAYERMERGE
CL_LAYERMERGE(target_layerstr, source_layer_astr [, source_layer_bstr [, ...str]])
Available only on Custom Loop templates.
Moves all the entites on each source_layer onto the target_layer, then deletes the source_layers, in the generated loop.
Returns an empty string.
Available from: 8.8.2.0.
CL_INSERTDWG
CL_INSERTDWG(dwgstr [, Xfp, Yfp])
Available only on Custom Loop templates.
Insert the drawing file named by dwg at the point X,Y relative to the insertion point of the formula on the template (inserts at the formula if X and Y are not supplied).
See Custom Loop drawings CL_INSERTDWG for more information.