LTRIM - connect_cdc_sqdata - Latest

Connect CDC (SQData) Apply engine

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (SQData)
Version
Latest
Language
English
Product name
Connect CDC (SQData)
Title
Connect CDC (SQData) Apply engine
Copyright
2024
First publish date
2000
ft:lastEdition
2024-07-30
ft:lastPublication
2024-07-30T20:19:56.898694

LTRIM examines a data string from left to right and compares the contents to an exclusion character string. If a match is found between the data string and the exclusion character string, the LTRIM function removes the characters which match the exclusion character string. LTRIM continues until the first non-matching character is found. It also provides flexibility regarding the method of comparison by specifying either the ANY or MATCH parameter. Note that for single character exclusion strings, ANY and MATCH will return the same results.

Category

String

Syntax
LTRIM(data_string, exclusion_character_string, ''ANY' | 'MATCH')
Parameters and Descriptions
Parameter Description
data_string The data string in character format. The data string can be a field from a source datastore, a variable, a constant or the result of another Function.
exclusion_character_string One (1) or more characters that are to be removed from the left hand side of the data string. Exclusion characters may be a field of a source datastore, a literal value or the output of another Function.
ANY | MATCH Denotes the type matching from the left side of a source data string based on the contents of the exclusion character string.
  • ANY - Indicates that partial matches to the exclusion sting are allowed. ANY is most useful when the exclusion string is more than one character. As LTRIM scans the string from left to right, the current character will be removed if it appears anywhere in the exclusion string. Thus, the exclusion string should be thought of as a list of characters which have no order. LTRIM will stop scanning when it encounters the first non-matching character. All characters before this point will be removed.
  • MATCH - Indicates that an exact match to the exclusion string must be made. Starting on the left, LTRIM compares the first character in the exclusion string to the current character in the data string, then the next character of the exclusion string to the next character of the data string to see if it matches and so on, until a non-matching character is found. If a full match is found, it is removed from the data string and LTRIM continues scaning the data string to see if there is another exact match to remove until all contiguous repeating instances of the exclusion string have been removed from the data string.
Note: These parameters must be enclosed in single quotes.

Example

LTRIM with datastore field, literal, variable, output of another Function.

This is a test
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM('ABCD', 'A', 'MATCH')
TARGET.FIELD = LTRIM(VARIABLE, 'A', 'MATCH')
TARGET.FIELD = LTRIM(FUNCTION(SOURCE.FIELD), 'A', 'MATCH')

--Assuming SOURCE.FIELD = 'ABCD', VARIABLE = 'ABCD', and the result of

--FUNCTION(SOURCE.FIELD) = 'ABCD', the results would be 'BCD' for all cases.

LTRIM with the exclusion string as a datastore field, literal, variable, output of another Function.
TARGET.FIELD = LTRIM('ABCD', SOURCE.FIELD, 'MATCH')
TARGET.FIELD = LTRIM('ABCD', 'A', 'MATCH')
TARGET.FIELD = LTRIM('ABCD', VARIABLE, 'MATCH')
TARGET.FIELD = LTRIM('ABCD', FUNCTION(SOURCE.FIELD), 'MATCH')

--Assuming SOURCE.FIELD = 'A', VARIABLE = 'A', and the result of

--FUNCTION(SOURCE.FIELD) = 'A' the results would be 'BCD' for all cases.

LTRIM with one character returns the same result for both MATCH and ANY keywords
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'ANY')

--Assuming SOURCE.FIELD = 'ABCD', the results would be 'BCD' for all cases.

LTRIM will remove multiple contiguous instances of a match.
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'MATCH')
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'A', 'ANY')

--Assuming SOURCE.FIELD = 'AAABCD', the result would be 'BCD' for either case.

LTRIM will remove multiple contiguous instances of a match
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'AB', 'MATCH')

--Assuming SOURCE.FIELD = 'ABABCD', the result would be 'CD'.

LTRIM with ANY keyword. Order does not matter
TARGET.FIELD = LTRIM(SOURCE.FIELD, 'ABC', 'MATCH')

--Assuming SOURCE.FIELD = 'CABCDA', the result would be 'DA'.