Search bar with suggestions

I have been following up this power-up guide and i cant seem to figure out this part of the tutorial.
The formulae used here. Can anyone help me out with this formula.

regards. Inno

Hi!

The full formula is FIND(appVars.products, params.product_id == item.id) :slight_smile:

okay, I am abit confused, the page which shows the name of the selected product is bounded to what variable. (pageVars.selected_product.name) ?? the page variable name cannot take names with dots.
i am confused here.

Kindly help me out. @Cecilia

FIND(appVars.products, params.product_id == item.id)

This formula is basically returning a sub list of products from the app variable products whose id is equal to the product_id passed as the page parameter.


Hi there,

Any idea why I’d be getting the syntax error? I’ve also been following this video.

Don’t ever add space between the name of the formula and the parentheses…
So pay attention to white spaces. The formula is good. Just omit the space…

FIND(appVars.books, params.Book_id == item.id)

This makes the app think you had something in mind then another something, but not something in mind that has a few subset of thoughts.

I am looking to retrieve the results from multiple fields (firebase database)

This formula for the repeat list is working :
SELECT(data.Firestore_items1, CONTAINS(item.fields.item_name.stringValue, pageVars.search_text))

How can I add more objects to look for search input value ?
this one don’t work.
SELECT(data.Firestore_items1, CONTAINS(item.fields.item_name.stringValue, item.fields.model.stringValue, pageVars.search_text))

Thanks !

Hey, just an idea, I have to work out the proper formula later.
Use an approach of joining two (or more, based on the number of different properties you want to search for) lists of objects, where each of the lists of objects is created with the above mentioned SELECT or SELECT_BY_KEY formulas.
Read through the docs about the “list” formulas and you might be able to get it to work.
If you need more help, let us know.

Hi Mihaly,

Thank you. I still have a lot of things to read and learn.
every day i spend on appgyver is exciting !

I think you are talking about this video :

Maybe should I use Firestore Indexes ?

I don’t know what’s the more efficient method in my case because I’ve not enough experience.

This power-up is not what I meant. Let me write a more coincise post later on.

Okay, the solutions seems to be easier as expected. But first let’s note that if You have huge collection with a lot of documents in it in Firebase you might consider using some effective query to limit your read-counts. But if you have a collection and you get that as a data resource you can do the following:

SELECT(data.Firestore_items1, (CONTAINS(item.fields.item_name.stringValue, item.fields.model.stringValue, pageVars.search_text)||(CONTAINS(item.fields.model.stringValue, pageVars.search_text)))

In the formula “||” is the “or” logic so the function will return all objects that have a matching property, shall it be only one matching property or multiple.

Hope it helps.