Is it possible to split the Location field to several address formula fields in Ninox?
I want the Location filed to split and copy the address to several fields like Street, ZIP, City etc, is that possible?
6 replies
-
Yes. This should put you on the right track. You just need to split the Location field into an array. To show how this works create a formula field and expand it over several lines. Then paste this and change Location to your location field:
let tempArray := split(text(Location), ", ");
let tempFullAddress := item(tempArray, 0) + "
" + item(tempArray, 1) + "
" + item(tempArray, 2) + "
" + item(tempArray, 3) + "
" + item(tempArray, 4) + "
" + item(tempArray, 5);
tempFullAddressYou just need to move each array line into a different field for each line of the address.
-
Need one more split() function because the zip and city are separated by a space.
item(split(text(Location), ","), 0) + "
" + split(item(split(text(Location), ","), 1)," ",0)+ "
" + split(item(split(text(Location), ","), 1)," ",1)+ "
" + item(split(text(Location), ","), 2)Steven.
-
You can also use the extractx function to retrieve the different valuers.
Here are the two fields that are in the form:
And here is the formula to extract the values and create a JSON variable that contains the results:
parseJSON(extractx(text(Location), "(.*),(.*\d) (.*),(.*)", "{""address"":""$1"", ""zipCode"":""$2"", ""city"":""$3"", ""country"":""$4""}")); // return JSON values : {"address":"56 Av. des Baleares","zipCode":" 66100","city":"Perpignan","country":" France"}
See the extractx function in the documentation and this tool to create and test regular expressions
Content aside
- 2 yrs agoLast active
- 6Replies
- 255Views
-
5
Following