How do I get the amount of times a certain value appears in Firebase database?

Hello!

I'm farelly new to the MIT APP INVENTOR and Firebase so here it goes.

I'm trying to get the amount of times a certain value exists in a Table. So let's say I want to see how many times "francisco" has claimed codes so it would be 3 in this case.
a

Here is how you would do it if you had the entire table in memory as a 2 column table:

global categories_text global details_text group_sum.aia (6.5 KB) retail_sample - Categories.csv (310 Bytes) retail_sample-details.csv (998 Bytes)

If you don't want to download the entire table, you would have to revise your data storage tree in FireBase, adding or replacing your tags to store by name instead of by ID, as a secondary index.

Search for 'FireBase Data Modelling' for samples.

1 Like

Ooosh that's some big code! Thank you :slight_smile:

Another approach

image

1 Like

By The Way, here is a link to a discussion of how to structure data for this type of problem when there is a lot of data.
(The version of FireBase might not be exact, but the concept applies.)
https://firebase.google.com/docs/database/web/structure-data

To answer the question:

image

1 Like