Skip to main content
Question

Hi, I have an attribute by the number 0821 and similar which I want to add next to another counter attribute that starts on 01 and goes on 02, 03 etc. My attrbute KnKod_1 looses the leading 0 to the left. See expression in Arithmetic ed. in the pic


karloz9999
Contributor
Forum|alt.badge.img+1
Hi, I have an attribute by the number 0821 and similar which I want to add next to another counter attribute that starts on 01 and goes on 02, 03 etc. My attrbute KnKod_1 looses the leading 0 to the left. See expression in Arithmetic ed. in the pic.

5 replies

karloz9999
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 13, 2023

_ProjectID_Test2 should have:

082101

On the first row there.


nielsgerrits
VIP
Forum|alt.badge.img+54

This can be done with the function @PadLeft(<string>,<padLength>) or the StringPadder transformer.


karloz9999
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 13, 2023

Does not seem to work, I added it around just the first @PadLeft(@Value(KnKod_1),1) and also around the whole expression. No errors and no difference in the attribute.

image


karloz9999
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • September 13, 2023

Ok, StringPadder transformer worked better :)

 


nielsgerrits
VIP
Forum|alt.badge.img+54
karloz9999 wrote:

Does not seem to work, I added it around just the first @PadLeft(@Value(KnKod_1),1) and also around the whole expression. No errors and no difference in the attribute.

image

It should be 

@PadLeft(@Value(KnKod_1),6,0)

where '6' is the number of characters you want to have and '0' is the character you want to use.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings