CONCAT block

Short summary

Name

CONCAT

→POU type

→function

Category

IEC-block, String, block with internal error diagnostic

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/error.svg currently restricted
(IEC demands data type ANY_CHARS for the inputs, hence the following data types are demanded as well: WSTRING, CHAR, WCHAR . Currently, these data types are not supported for the block.
IEC demands data type ANY_STRING for the return value, hence the following data type is demanded as well: WSTRING. Currently, this data type is not supported for the block.)

Graphical interface

images/download/thumbnails/414782652/CONCAT-version-1-modificationdate-1535103223074-api-v2.png

Available since

version 1.31.0 for logi.CAD 3)

Functionality

The block concatenates (combines) partial strings to a new string. Enter the partial strings at the corresponding inputs.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg logi.CAD 3 determines the character positions within a string as follows: 1, 2, ..., n. 1 corresponds to the leftmost character position and n to the length of the string.
Three-character combination of the dollar sign ($) followed by two hexadecimal digits are evaluated as single character. Example: The string '$B15' (corresponds to '±5') consists of 2 characters. See →character string literal for more examples for those combinations.

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN1

STRING

1st value

IN2

STRING

2nd value

... (extensible until)

IN16

STRING

16th value

Return value:

STRING


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks the would-be return value.
If the return value cannot be mapped in the available memory (the return value is too large), the output ENO of the block is set to value FALSE (or an equivalent). When you are using nested blocks with STRING values, observe that the memory for STRING values is restricted (see "In case of nested string blocks: How can the return value be entirely mapped ?" for details and examples).
The following special case might occur regarding this error case: If the result of the call is assigned to a variable that is used as input parameter for the call of this block as well (see the following example), the output ENO of the embracing →POU is set to value FALSE for this error case (but not the output ENO of the called block). Example: ResultString := CONCAT(IN1 := 'a', IN2 := ResultString);

Example for usage within ST-editor

PROGRAM Test
VAR
result1, result2 : STRING[20];
result3 : STRING[10];
CheckENO1, CheckENO2, CheckENO3 : BOOL;
END_VAR
result1 := CONCAT(IN1 := 'any', IN2 := ' st', IN3 := 'ring', ENO => CheckENO1);
(* The variable 'result1' evaluates to <'any string'>. The variable 'CheckENO1' evaluates to 'TRUE'. *)
result2 := CONCAT(IN1 := 'Deviation: ', IN2 := '$B15', ENO => CheckENO2);
(* The variable 'result2' evaluates to <'Deviation: $B15'>. The variable 'CheckENO1' evaluates to 'TRUE'. *)
result3 := CONCAT(IN1 := 'an', IN2 := 'other value', ENO => CheckENO3);
(* The variable 'result3' evaluates to <'another va'>. The variable 'CheckENO3' evaluates to 'FALSE'. Reason: 'result3' is declared with length '10' and the would-be return value exceeds this length. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.