LEFTPAD
Use the LEFTPAD function to left-pad the text with the specified character a given number of times.
Use
LEFTPAD( text, character, times )
Left pad the text with the given character a number of times.
| Parameter | Required | Description |
|---|---|---|
| text | Yes | the text to pad |
| character | Yes | the character to use to left pad |
| times | Yes | the number of times to insert the character |
| Returns | Text |
Examples
Formatting Numeric IDs (Adding Leading Zeros)
In many workflows, numeric IDs need to be presented in a standardized format for reports or external systems. You can use LEFTPAD in an Input Mapping formula to ensure a number is preceded by specific characters.
- Scenario: You want to display a system-generated run number as a four-digit string by adding three leading zeros.
- Formula:
LEFTPAD(TEXT(@prop.RunNumber), "0", 3) - Logic:
TEXT(@prop.RunNumber): Because LEFTPAD requires a Text data type, you must first convert the numeric run number to text."0": This is the character literal to be used for padding.3: This tells the system to insert the character three times.- Outcome: If the current
@prop.RunNumberis 5, the formula will return "0005".
Visual Hierarchy in Summary Fields
You can use LEFTPAD to create visual structure or "indentation" when displaying data in a Content Block or a summary form. This helps differentiate between main items and sub-items.
- Scenario: You are building a form that displays a list of sub-tasks. To make the sub-tasks stand out from the main project title, you want to prefix them with two arrows (
>>). - Formula:
LEFTPAD(@Trigger.out.SubTaskName, ">", 2) - Logic:
@Trigger.out.SubTaskName: The text captured from the trigger step.">": The specific character to insert at the beginning of the text.2: The number of times the character is repeated.- Outcome: If the sub-task name is "Safety Audit", the result will be ">>Safety Audit".