Update city in a new field from location tag.
Can someone help me on this one.
Have seen an example based on the US Location, but i need from these string the city "Nieuw-Weerdinge" i have extract this data from my database x.Location and with an update trigger i populated the field x.Citytest
Pottendijk Westzijde 20, 7831 VB Nieuw-Weerdinge, Nederland <52.81871414944948,6.984786373469433>
10 years ago i did a lot on database level entries, but i feel a bit stuffed and Rookie on this :)
thanks for assistance in advance
Ruud
5 replies
-
Would like to repost this one if there is any who has solution for me.
From this string, wich comes from location field, i would like to retrac only the city
"Nieuw-Weerdinge"
Quote:
Pottendijk Westzijde 20, 7831 VB Nieuw-Weerdinge, Nederland <52.81871414944948,6.984786373469433>
Unquote
Its should be a uniform solutions for all 2500 places in Nederland.
Any thougths on this ?
Thanks again
Ruud
-
let myText := text('location field');
let myTextArray := split(myText, ",");
let myCity := item(myTextArray, 1);
let myCityArray := split(myCity, " ");
item(myCityArray, 2)
-
Thank you David G, for this solution, will try this one, when back from work.
Question does this also work for a string whereby "Nieuw-Weerdinge" is "Nieuw Amsterdam" so without a -minus.
The postcode is always "4digits space 2letters" so the real City starts after 8spaces till next comma.
Appreciate your help, thanks in advance.
Ruud
-
I am playing around and i have created a formulafield for this based on David's suggestion.
let myText := text(Location);
let myTextArray := split(myText, ",");
let myCity := item(myTextArray, 1);
let myCityArray := split(myCity, " ");
item(myCityArray, 3) + " " + item(myCityArray, 4) + " " + item(myCityArray, 5) + " " + item(myCityArray, 6) + " " + item(myCityArray, 7)from this formulafield i use on click to populate another tablefield:
let c := this;
c.(CityAreasNL := 0);
let v := first((select CityAreasNL)[trim(City) = trim(c.CityFromLocation)]);
if v then
alert("Polulate [" + v.Id + "]");;
c.(CityAreasNL := v)
endI have to admit that i am not familiar with some coding but still along its getting better :)
The only thing i struggle yet is that i need to click on the formula field to populate the CityAreasNL table.
Any thought how to automate that??
Ruud
-
Found a solution for this, on my galaxy s10 its not possibble to click on the formulafield (CityFromLocation) to update the CityAreasNL table, so i removed the code from (CityFromLocation) on click, towards the (Location) field "trigger on update"
let c := this;
c.(CityAreasNL := 0);
let v := first((select CityAreasNL)[trim(City) = trim(c.CityFromLocation)]);
if v then
alert("Polulate [" + v.Id + "]");;
c.(CityAreasNL := v)
endthan it first populates the formula field and than it update the other table without clicking on the (CityFromLocation)
Also on my Galaxy S10 it solved.
Hope this also helps other strugglers.. :)
Ruud
Content aside
- 5 yrs agoLast active
- 5Replies
- 1364Views
-
1
Following