cancel
Showing results for 
Search instead for 
Did you mean: 

concatenation function in Webi

former_member203111
Participant
0 Kudos

Hi

I have Material field and some materials are 4 digit and some are 5 digits

Users want to see zero with 4 digit material code e.g 01234 but dont want to see zeros with 5 digit code.

I have concatenated the material with 0 in the beginning of every material but since it is also showing 0 with five digit material code as well which is not acceptable.

Is there a logic I can write while concatenate on the material field that it only add 0 in front of 4 digit material but not add anything before 5 digit

for example,

Field: Material Code:

01234 ( zero before the material code)

05678 ( zero before the material code)

01000 ( zero before the material code)

87694 (no zero before the material code)

Will appreciate the help.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

amitrathi239
Active Contributor
0 Kudos

try this.

=if(length([material])=4) then "0"+[material] else [material]

former_member203111
Participant
0 Kudos

Excellent, Thanks alot Amit, Appreciate your help.

Answers (2)

Answers (2)

former_member492038
Participant
0 Kudos

While Amit's solution works, I'd suggest using the LeftPad function. For what you've asked it wouldn't make a difference, but LeftPad will be generally more useful as it could ensure that items of even 3, 2, or 1 characters in length will always have the appropriate amount of zeros added in front to make them 5 characters long

=LeftPad([Item]; 5; "0")
former_member203111
Participant
0 Kudos

Thank You William

amitrathi239
Active Contributor
0 Kudos

use this.

=if(length([material]=4)) then "0"+[material] else [material]

former_member203111
Participant
0 Kudos

HI Amit,

Is something wrong with my syntax, please let me know, Thanks (Material is Item, same thing)