UK Postcode formatter 🏡

Danny Roden
Danny Roden Administrator
edited January 25 in Functions library

Summary

This package contains a single function but may be updated in the future to include others.

UK Postcode formatter 🏡

This function simply adds a space between the incode and the outcode for a given UK postcode (e.g. SW1A1AA becomes SW1A 1AA).

See below for preview of the function definition logic and some sample output results:

Compatibility:

These functions are compatible with all instances of Data Studio from v2.12.8 onwards.

Comments

  • Not sure why, but the postcode formatter is not working for me. My goal is to tidy up our postcodes, i.e. remove leading, trailing and any additional (double) spaces between outcode and incode. I used 'remove whitespaces' first, then used 'postcode formatter' on the output. As per below screenshot, the space is not being added in. Any ideas what I am doing wrong please?

    thank you

  • Danny Roden
    Danny Roden Administrator

    Thanks for the feedback @Lucy. The function logic has now been reviewed and updated. If you download the latest version of the function you'll note that your example is now one of the test values and I've simplified the logic to make this much more flexible. Hopefully that does the job!

  • Hi Danny,

    you mentioned above that 'his package contains a singe function but may be updated in the future to include others'

    Do you mean other postcode formats? Is this something you're working on? thanks

  • Lucy
    Lucy Member

    @Danny Roden it's now working well, thank you very much!

  • Danny Roden
    Danny Roden Administrator

    @Emilia Fuks some of the other .dmx packages provided in the functions library contain multiple functions (for example this entry contains 3 different functions all related to the same peice of functionality:

    If there's additional feedback on this function and a requirement to add others (that would make sense to add to this package), this post may be updated in the future to acocmodate this.