Skip to main content

Hey guys,

 

I have an CSV file where I have 4 different columns with values (column1 till column4). I'am creating in the attribute manager a new columns (column5) where I connect all the values of the first four columns with a point in between.

 

 

 

For example

 

 

```

column1, column2, column3, column4, column5

1, 2, 3, 4, 1.2.3.4

```

 

 

`column2` has the special that there are numbers from `1` til `99`. I want to put infront all values of `column2` which are from `1` til `9` a `0`, so that it looks like the example. But already two digits numbers should not get a `0`.

 

 

 

For example

 

 

```

column1, column2, column3, column4, column5

1, 02, 3, 4, 1.02.3.4

 

3, 65, 5, 9, 3.65.5.9

```

 

How can I manage this? Has anybody a clue? Or could somebody help me please?

 

Thanks in advance!

 

Have a good day!

 

Cheers,

 

Fabian

Hi Fabian, you can use the StringFormatter before the AttributeManager. Have the format string as '02d'


Hi hkingsbury,

thank you for your answer. I will try it today!


Alternatively you can use @PadLeft when defining column5 in the AttributeManager.

@Value(column1).@PadLeft(@Value(column2),2,0).@Value(column3).@Value(column4)

 


@hkingsbury​ it works really well! thanks a lot!


Alternatively you can use @PadLeft when defining column5 in the AttributeManager.

@Value(column1).@PadLeft(@Value(column2),2,0).@Value(column3).@Value(column4)

 

thank you @geomancer​ this option worked also!


Reply