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

  • September 13, 2023
  • 5 replies
  • 7 views

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+64

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+64

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.