Skip to Content

concatenation function in Webi

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 20, 2017 at 08:13 PM

    try this.

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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 20, 2017 at 06:04 PM

    use this.

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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 20, 2017 at 11:12 PM

    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")
    Add comment
    10|10000 characters needed characters exceeded