Starts with
The Starts with compare type checks if the text (String) given as the Check value (value configuration on the left) starts exactly with the string (String) defined as the Compare value (value configuration on the right).
The screenshot above uses static text value resolvers (see Static values) with the texts 'Check value' and 'Compare value' to illustrate the interaction of the components.
►NOTE◄
The text comparison is case sensitive.
There is no automatic conversion of unsuitable values to text (String). When required, the Input object (type safe) value resolver or a suitable value resolver from the String processing category can be used to convert another data type into a string.
Special cases:
The check is considered failed if at least one of the value configurations (Check value, Compare value) does not return a String.
Since 'No value' ($null) is also not a String, a check like ($null) Starts with ($null) is considered failed.
If the Check value and the Compare value completely match, a Starts with comparison is considered passed.
An empty string ("") can be used as a Check value and as a Compare value. A check with "" as a Compare value will always pass if the Check value is a String.
Specific examples:
Check value |
Compare value |
Check result |
Comments |
"123.45" |
"123.45" |
|
Check value Starts with the Compare value |
"123.45" |
"12" |
|
Check value Starts with the Compare value |
"123.45" |
"11" |
|
Check value does not start with the Compare value |
"" |
"12" |
|
Check value does not start with the Compare value |
123.45 |
"12" |
|
Check value is not a String |
$null |
"12" |
|
Check value is not a String |
"123.45" |
12 |
|
Compare value is not a String |
"123.45" |
$null |
|
Compare value is not a String |
"123.45" |
"" |
|
Check value Starts with the Compare value |
$null |
$null |
|
Check value is not a StringCompare value is not a String |
"" |
"" |
|
Check value Starts with the Compare value |
Configuration
The value configurations for Check value (left) and Compare value (right) are not optional for the Starts with compare type.
Both value configurations must return strings (String) at runtime, otherwise the Entity property rule is considered failed.
Examples
Evaluate a text input
An Entity property rule evaluates a User prompt so that any input that does not begin with the letter 'n' (or 'N') is evaluated as false ('reject') and all others (except "") are evaluated as true ('agree').
►NOTE◄ There are, of course, more effective ways to query a purely 'binary' decision from a user, such as the User callback event action. After all, a user might also want to express his 'agreement' by typing 'Of course!'. In this respect, this example is intended to demonstrate the use of the Starts with value resolver rather than best practice in Lobster Data Platform / Orchestration.
Configuration:
Within an Entity property rule, the following value resolvers are concatenated in the Check value (left):
On the right, the lowercase letter 'n' (see Static values) is juxtaposed as a Compare value. ►NOTE◄ As can be seen from the label 'not(...)' in the image, the Starts with compare type is negated here (see not (Matcher)), so that the check is considered passed if the User prompt does not start with 'n'. |
|
Compare two text files
It is determined whether a text file version.txt was (or at least could be) created by 'extending' another file original.txt in the context of an event handling.
Both files already exist as uploads in a server file system path readable by Lobster Data Platform / Orchestration.
Configuration:
Within an Entity property rule, two instances of the File reference value resolver are used to access the files to be compared (in a subdirectory test of the designated upload folder for Lobster Data Platform / Orchestration). The File reference value resolver primarily returns a 'Content' object as return value, which represents the plain text of a text file as a byte array (byte[]) in the body field. However, this byte array also forms the basis for the string image of the 'Content' object by default. Therefore, for a text file the concatenated Input object (type safe) value resolver with the String 'type' provides the plaintext relevant for the comparison. |
|
►NOTE◄ The Entity property rule with the Starts with compare type is also considered to have passed if the contents of the version.txt file are identical to original.txt. In order to reliably ensure – as formulated above – whether the original file was actually 'extended', it must therefore be excluded in the context of an AND conjunction by an additional condition that the file contents are identical (e.g. with not (Matcher) and Equal to).