Simulating a 'BEGINS WITH' Search?

advanced-prototyping

#1

I’ve seen many suggestions for doing a contains with search, but i’m having trouble finding suggestions on how to create a begins with search filter? Can anyone help?

In the example:

  • Apple
  • Banana
  • Cherry

If i typed in “A” in the search field, the only result that should appear is Apple, because even though Banana contains A, it does not start with A.


#2

[[ Item.Column0.indexOf(“A”) == 0 ]]

if you want to ignore case

[[ Item.Column0.toLowerCase().indexOf(“A”.toLowerCase()) == 0 ]]


#3

you should try this.
[[Item.First_Name.toLowerCase().indexOf(LVAR1.toLowerCase()) == 0]]

You want to setup a local variable to avoid limiting yourself. So the first letter you type will return all the items starting with that letter, then second and so on.

For example: if you type “a”, you could return:

  • Acerola
  • Apple
  • Apricots
  • Avocado

If you type “ap”

  • Apple
  • Apricots

If you type “apr”

  • Apricots

Hope this helps.