I have a bus stops point dataset. There is a field called "IsBusStop" and every single point is set to Y. The problem is, some of the points are actually loading zones, not bus stops. There is a point description field which includes "LOADING ZONE" for those points. I need to find that text, and then change IsBusStop to N. I'm trying to use the Find() function, but it's not working. I need something along the lines of "LIKE" in SQL.
Here is my expression so far:
var description = $feature.PointDescription
var busstop = $feature.IsBusStop
var lz = Find('LOADING ZONE',description)
When(lz == 1, Replace(busstop, 'Y', 'N'),busstop )
Solved! Go to Solution.
Thanks for this, but I need to change the IsBusStop field based on whether or not "LOADING ZONE" is found in the description field.
I just figured it out.
var description = $feature.PointDescription
var busstop = $feature.IsBusStop
var loadingzone = Find('LOADING ZONE',description)
var lz = Find('LZ',description)
When(loadingzone > 0 || lz > 0, Replace(busstop, 'Y', 'N'),busstop)
var description = $feature.PointDescription
var lz = Find('LOADING ZONE',description)
IIf(lz == -1, 'Y', 'N') // 'LOADING ZONE' not found -> 'Y'
You could also replace 'LOADING ZONE' and check if the description has changed:
var description = $feature.PointDescription
var repl_description = Replace(description, 'LOADING ZONE', '')
IIf(repl_description == description, 'Y', 'N' )
Thanks for this, but I need to change the IsBusStop field based on whether or not "LOADING ZONE" is found in the description field.
I just figured it out.
var description = $feature.PointDescription
var busstop = $feature.IsBusStop
var loadingzone = Find('LOADING ZONE',description)
var lz = Find('LZ',description)
When(loadingzone > 0 || lz > 0, Replace(busstop, 'Y', 'N'),busstop)
but I need to change the IsBusStop field based on whether or not "LOADING ZONE" is found in the description field.
Yes, but if the IsBusStop field can only have the values "Y" and "N", then you don't actually need to replace that value, you can just set it.
but I need to change the IsBusStop field based on whether or not "LOADING ZONE" is found in the description field.
That's because you use another expression. Try it with the expression that actually worked.