Right trim

See also: Trim, Left trim

Value resolver – Abstract

Purpose: Removes trailing whitespace characters from a string passed as input value.


images/download/attachments/106958300/image2022-6-30_10-38-6-version-1-modificationdate-1656578286712-api-v2.png

The Right trim value resolver removes trailing whitespace characters from a string passed as input value.

  • If no value ($null) is present as input value, no value ($null) is returned.

  • For input values that are not strings, their string mapping is processed.

Configuration

The Right trim value resolver expects a string as input value and does not use any parameters.

Example

Whenever a Lobster Data Platform / Orchestration client session is logged in via login or the browser is reloaded with an already logged in session, it is then checked whether a notification (in the form of a text file) exists for the current calendar day. If this is the case, the text from this file is displayed in a message box.

  • The administrator can upload messages per calendar day to a non-public folder set up for this purpose of the Lobster Data Platform / Orchestration server file system (./upload/billboard/alert/).

  • The format for the file name is arranged as follows: <Stichtag im Format yyyyDDmm>_all.txt so e.g. 20220630_all.txt for a message that is displayed on 30th June 2022.

To prevent the message windows from being unnecessarily large, whitespace (spaces and before all blank lines) at the end of the message should be automatically removed.

Runtime example:

images/download/attachments/106958300/image2022-6-30_10-43-41-version-1-modificationdate-1656578621986-api-v2.png

Configuration:

The 'Client logged in' and 'Client reloaded' events (see Login (Events)) are selected as Triggering events for event handling.

The Validating rule uses an Entity property rule to determine whether the agreed directory contains a message for the current calendar day:

  • A Concat strings value resolver builds the current-day file path. The Format date value resolver is concatenated with the Relative date with time value resolver (collapsed in the image) to output the system date ('Now') in the format yyyyMMdd.

  • If there is a file in the specified path, the File reference value resolver returns it as a 'Content' object. Within the Validating rule, only the 'non-empty' return value is of interest. As a precaution, however, the return value is stored in the file variable by the Store value as variable value resolver, so that the file does not have to be read again when successful.

  • The only Action on passed rule displays the message by a Show alert (Popup) event action that reads the file content (body) from the file variable and 'edits' it via the concatenated Right trim, in order to remove whitespace at the end of the file, if necessary.

NOTE

  • For the Type 'Alert', the Close after (seconds) setting is irrelevant, because the displayed message dialog can only be closed interactively (by clicking on 'OK').

  • Since the string representation of a text file (in a 'Content' object) is by definition the plaintext of the file, the Object property value resolver for the body could be omitted here. Its return value (of the byte[] type) effectively provides the same string as input value for the Right trim value resolver.

images/download/attachments/106958300/image2022-6-30_10-39-21-version-1-modificationdate-1656578361738-api-v2.png