Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi.
What is the best way in the script to do some string functions like this,
if some places are with North or north (like london north or Dublin south) I would like to have the result "N" or "S".
Thanks in advance!
You could try a mapping like:
map1:
Mapping load * Inline [
x, y
Norra, N
Södra, S
norra, N
södra, S
];
Then for your field do:
MapSubString('map1', Station) as Station
Hope this helps!
Capitalize(Left(Subfield(YourFieldName,' ',2),1))
Something like below...
=Capitalize(Left(Subfield('Dublin south',' ',2),1))
Björn,
Wildmatch() could suit you
Fabrice
I tried with:
if(wildmatch(station,'*North*'), 'N',
if(wildmatch(station,'*north*'),'N',
if(wildmatch(station,'*South*'),'S',
if(wildmatch(station,'*south*'),'S')))) as StationLink
But it doesen't give me the result I want. I have a field with many stations end I want to "wash" the field so that every station have a N or a S if they have two (or more) ways to exit the station.
Give us some example of your station field...
If my solution is not working?
See attached example.
Maybe something like this?
pick(wildmatch(Station, '*Norra*', '*Södra*')+1, Station, 'N', 'S')
I wasn't sure what do to do if the name didn't have either north or south in it, so if it didn't it just returns the station name.
Hope this helps!
That one is not working. I'm looking for the station name and the N or S as London N.
Just to try and understand your requirements a little more, you want
'Bergshamra Norra' to be 'Bergshamra N'
and
'Bergshamra Södra' to be 'Bergshamra S'
?
What about if there is no South or North, you want just:
'Duvbo' to be 'Duvbo'
?
What if there is a North in the middle:
'Gardet Norra AU 1' to be 'Gardet AU 1 N'
?
Or do you want a field with just station and no directions, and then another field with either N, S, or null?
Can you describe it a little more?
Yes you have understand the requirement right. If the station have a direction it should be N or S.