Skip to main content

Currently imported a 'subledger' text string via Attribute Manager. Need to have leading zeros added to the left so it is always 8 characters. For example, '1046' should be '00001046'. Please advise which Transformer should I use.

 

Also another 'subledger type' text sting is dependent on the above 'subledger' field. If no subledger, it shows blank. If something in the subledger, then 'W' should show under 'subledger type'. Please advise how to achieve. Thanks.

The term you are looking for is Padding. Adding leading zeros can be done using the StringPadder transformer. As an alternative you can use @padleft in the AttributeCreator / AttributeManager etc.

 

The other thing you need is Conditional Values. In the AttributeCreator you can assign values based on conditions:

2022-08-29_08h35_02 

I'm not sure you want do the conditions on an attribute in the same row or a previous row. If you need a previous row you can use Adjacent Feature Attributes:

2022-08-29_08h44_17This allows you to use values in previous and/or subsequent features.


Concerning the leading zeros, the easiest is probably to use a StringFormatter with "08s" as the format string. But yes, you can of course also use the @padleft function as well.


Reply