Skip to main content

Autocomplete From Collection - Search Part of String

Comments

6 comments

  • Patrick Fingler

    Hi Ryan,

    You just need to add another % before your query.  For example, this query (COMMON_NAME LIKE 'PINE%'_ searches for trees that start with "PINE", while this query (COMMON_NAME LIKE '%PINE%') searches for trees that include the word "PINE" in their name. 

    Here is a sample workflow for reference:
    https://latitudegeo.maps.arcgis.com/home/item.html?id=13cb5d4e8f674f48bba963a0a7d77a52

    I'd recommend using the default autocomplete suggestions template rather than using the Filter Form Element Items activity as well.

    Cheers

    -- Patrick

    0
  • Ryan Kelley

    Thanks Patrick. I think this is where I am stuck though. I don't have a where clause to use. I am not using a REST query, as the collection I populated has nothing to do with GIS data... hence my need for the blank start to the subworkflow.

    0
  • Patrick Fingler

    Hi Ryan,

    Ahh yes, one option you could do would be to write a JavaScript expression to accomplish this.  I've updated the same workflow with a sample on how to do this.

    The expression will look something like =$inputArray.result.filter(x => x.includes($textReplace.result))

    That will give you an array with the filtered items.  You could then supply that output expression to the Filter Form Elements activity using =$filteredArray.result.join(', ')

    Hope that helps

    0
  • Ryan Kelley

    Excellent work Patrick!! Works like a charm! Thank you!

    0
  • Patrick Fingler

    No problem. Happy to help :)

    0
  • Scott Tram

    Hi ,
    Patrick Fingler 
     

    Wondering if I can have that JSON file. 

     

    Regards,
    Scott

    0

Please sign in to leave a comment.