'LIKE' function in Arcade

2821
4
Jump to solution
12-13-2018 08:16 AM
Lake_Worth_BeachAdmin
Regular Contributor

I am looking for a solution that replicates the 'LIKE' function in SQL statements. 

for example

IIF($feature.name LIKE 'target text', "", $feature.name)

if the target text is found in the feature attribute then it returns nothing, if it's not present then it returns the value found. 

I am trying to avoid the multiple uses of IIF and WHEN statements with a simple LIKE... is this functionality possible yet in arcade? 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Have you tried using the Find function: Text Functions | ArcGIS for Developers?

// IIF($feature.name LIKE 'target text', "", $feature.name)
IIF(Find('target text', $feature.name) > -1, "", $feature.name)

View solution in original post

4 Replies
XanderBakker
Esri Esteemed Contributor

Have you tried using the Find function: Text Functions | ArcGIS for Developers?

// IIF($feature.name LIKE 'target text', "", $feature.name)
IIF(Find('target text', $feature.name) > -1, "", $feature.name)
TaylorCarnell1
New Contributor III

What is the equivalent to Haystack LIKE 'b%'?
Find('b',Haystack) will succeed on "ab","abc","ba" and "b" whereas LIKE 'b%' is only true for "ba" and "b".

TaylorCarnell1
New Contributor III

I've realised, Find('b',Haystack) == 0 will match Haystack LIKE 'b%'.

0 Kudos
OlyPowers
New Contributor III

This took me a hot minute to get my head around it, but YES! This is a great solution until they get LIKE into arcade. Worked like a charm! (see what I did there??)

0 Kudos