Overview
This article explains how to use string padding techniques in Nintex Workflow to format numbers to a fixed length in workflows. It is intended for workflow developers who need consistent numbering formats such as document references, IDs, ticket numbers, or invoice numbers. The approach helps avoid inconsistent values caused by varying number lengths.
When to Use This
• Generating fixed-length reference numbers
• Creating document IDs
• Formatting ticket or case numbers
• Standardizing numeric output before storage or integration
• Building sequential numbering solutions
Problem / Limitation
Workflows often generate numbers with different lengths. For example, values such as 1, 10, and 100 may need to be stored as 00001, 00010, and 00100. Nintex Workflow does not provide a dedicated pad-left function in all workflow scenarios.
Root Cause
Numbers are stored and processed using their natural length. Without additional string manipulation, leading zeros are not automatically added.
Solution
Create a padding string containing enough zeros, concatenate it with the original number, and then extract the required number of characters from the end of the string. This creates a consistent fixed-length value regardless of the original number length.
Examples
❌ Incorrect
Original Number = 10
Result = 10
Explanation: The number is returned without leading zeros and does not meet a fixed-length format.
✅ Correct
Padding = 00000
OriginalNumber = 10
Combined = Padding + OriginalNumber
Combined Result = 0000010
Extract last 5 characters = 00010
Explanation: Concatenating zeros and then extracting the required length produces a consistently formatted value.
✅ Workflow Steps
1. Create Text Variable: Padding = "00000"
2. Create Text Variable: OriginalNumber = "10"
3. Set Variable: Combined = Padding + OriginalNumber
4. Use Modify String action: Extract substring from end of string
5. Length = 5
6. Result = 00010
Important Notes
-
Ensure the padding string is longer than the largest expected number.
-
The extraction length determines the final output length.
-
If the number exceeds the target length, the result may be truncated.
-
Use text variables rather than numeric variables when performing string manipulation.
-
Test with boundary values to verify formatting.
Related Topics
String Manipulation in Nintex Workflow
Creating Sequential Reference Numbers
