Filtering data collection based on PageParameters

Hi all,

Hopefully, someone will reply to this question…

I am trying to check whether a data already exists in my Firebase database before creating record.

In order to do so, I have tried the following:
On the create button, I have a logic node “Get data collection” from “Worksites” — filter:
Contains(data.Worksites[0].WorksitesName, pagevars.WorksitesName)

Pagevars.WorksitesName being the value of the New worksite name’s input.

I assumed (wrongly apparently) that by filtering the Firebase data on the input value, AppGyver could check if the record already existed…

BUT NO…

It is driving mad. Especially as I am sure it must izzypizzy…

Any help would be much appreciated.

Thanks

Matt

Hi @user7,

What CONTAINS(data.Worksites[0].WorksitesName, pagevars.WorksitesName) does is that it takes the name of the first worksite in the list and sees if it’s the same as your pageVar, so not what you want to do.

Instead, use IS_IN_ARRAY_BY_KEY to check the whole list for worksite names that match the new value:

IS_IN_ARRAY_BY_KEY(data.Worksites, "WorksitesName", pageVars.WorksitesName)

1 Like

@Mari : you a my heroe!

1 Like

Hey @Mari, is it possible to use LOWERCASE formula in combination with IS_IN_ARRAY_BY_KEY? If so, how?

Many thanks!

Matt

I have finally decided to set the input to capitalize word to normalize data entry