
Creator II
2023-10-04
02:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
adding leading zeros
Hi,
I need to add leading zeros
- If last character in a string having one integer then add three leading zeros.
- If last character in a string having two integers then add two leading zeros.
ex:
ACCL25 = 00ACCL25
ACCL9 = 000ACCL9
Thanks..
2 Solutions
Accepted Solutions

MVP
2023-10-04
02:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
If(IsNum(Right(FieldName,2))
,'00'& FieldName
,If(IsNum(Right(FieldName,1))
,'000'& FieldName)) as FieldName2
1,711 Views

MVP
2023-10-04
02:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Try like below
Load *, Repeat(0, 8-Len(field1))&field1 as field2 Inline
[
field1
ACCL25
ACCL9
];
Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Please close the thread by marking correct answer & give likes if you like the post.
4 Replies

MVP
2023-10-04
02:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
If(IsNum(Right(FieldName,2))
,'00'& FieldName
,If(IsNum(Right(FieldName,1))
,'000'& FieldName)) as FieldName2
1,712 Views

MVP
2023-10-04
02:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Try like below
Load *, Repeat(0, 8-Len(field1))&field1 as field2 Inline
[
field1
ACCL25
ACCL9
];
Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Please close the thread by marking correct answer & give likes if you like the post.

Partner - Master
2023-10-04
03:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, try the below.
Text(If(Len(KeepChar(FieldName,'0123456789')) =1, '000'&FieldName,
If(Len(KeepChar(FieldName,'0123456789')) =2, '00'&FieldName))) as FieldName2

Contributor II
2024-03-18
11:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Absolutely brilliant! Thank you very much!
