Skip to main content
Question

Change danish social security number


The danish social security number are build up like (ddmmyy-xxxx) where xxxx is a unique code.

I have a dataset from a xlsx-file, where the danish social security number are like (ddmmyyxxxx) AND if the date startes wtih 01, 02 ect, then it cut the zero of.

I need to make FME read the xlsx-file and change the danish social security number to this format (010180-1234) and write it to my PostGIS-DB.

I hope someone can help me with that.

Best regards,

Jacob Arpe

Kalundborg Municipalty

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+50

Here's what I did:

  1. StringLengthCalculator to calculate the length of the number. If it's 9 characters it's missing a leading 0. Those features get routed through an AttributeCreator that adds the 0
  2. AttributeSplitter to split the first 6 characters (the ddmmyy) off from the rest, this results in a list with 2 elements (_list{0} = '010180' and _list{1} = '1234')
  3. AttributeCreator to create a new attribute which is _list{0}, a dash and then _list{1}

Hope this helps. You may want to consider adding some extra error checking, e.g. in the TestFilter to see if there's any numbers which are not 9 or 10 characters in length.


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • July 21, 2016

If it's a fixed length and it's always the leading zeros you are missing you can simply use a string padder to add 0 to the beginning of the field to make it up to the required length. Once it is the required length you can split and add the - using attribute manager/attributecreator


  • Author
  • July 22, 2016
redgeographics wrote:

Here's what I did:

  1. StringLengthCalculator to calculate the length of the number. If it's 9 characters it's missing a leading 0. Those features get routed through an AttributeCreator that adds the 0
  2. AttributeSplitter to split the first 6 characters (the ddmmyy) off from the rest, this results in a list with 2 elements (_list{0} = '010180' and _list{1} = '1234')
  3. AttributeCreator to create a new attribute which is _list{0}, a dash and then _list{1}

Hope this helps. You may want to consider adding some extra error checking, e.g. in the TestFilter to see if there's any numbers which are not 9 or 10 characters in length.

It worked perfect. Some small modifications, but in general the workflow I need. Thanks.


  • Author
  • July 22, 2016
ebygomm wrote:

If it's a fixed length and it's always the leading zeros you are missing you can simply use a string padder to add 0 to the beginning of the field to make it up to the required length. Once it is the required length you can split and add the - using attribute manager/attributecreator

Didn't try this one, but StingPadder is also new to me, but a great tool. Can use the in other workflows. Thanks.


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