I need to separate the house number from the street and can only find “address line 1” which is both. Are there separate fields and I’m not seeing them or is there a way to separate them?
Hi @CathyS ,
I’m assuming this is for a CitizenHub build? If so, I’m not sure about the build itself but I assume it is just a single text single line property. So if you want to extract the house number then you would need to do so manually. However, this can be achieved in a few different ways, depending on your circumstance.
You can create a Function composite and use either the Split, Substring or Trim functions. All three will offer you the ability to extract the relevant information from your text. It’ll all depend on how your data is represented and how you want to extract the text.
Split will split each word based on a delimiter (e.g. spaces). Then you can choose which part of the split you want to extract. For example, if you have the following address:
123 Example Road
The function will extract each of the words; 123, Example and Road.
You can then choose which word you want to return by sequence.
For example, choosing 2 will extract the word Example.
Substring will allow you to extract a string based on a position and number of characters. For example, if you have the following piece of text:
This is an example!
You can specify from which position, starting from 1, and the number of characters to extract. Let’s say you specific to start from position 1 and to extract 4 characters, the following characters would be extracted; This
Trim will remove the piece of text to leave you with remaining text, but you have to specify the fixed text. For example, if you had the following text:
You would have to specify which text to remove. Let’s say you specified ‘World’, you would be left with the following text; Hello
I think what might be the most useful function here for your address field is the Split function, as you may not know the number of characters you need to extract, whereas this function simply splits by a delimiter.
2. Code Studio
Although this can be done in composites, you can do a similar thing in Code Studio to extract this data. You could create a Code Studio event action, specify your field and use the Split string function. Then you can identify which words have been identified and save the house number to the appropriate property.
Hope this helps