How to filter the dynamic component list, given that the data is from Firebase?

This is another extended question (Part 3?) of my previous discussion.
How to get data from Firebase to create a dynamic component list with a Schema template?
Thanks for @Still-learning’s solution a lot.

Actually, I still have a discussion is still undergoing, which is so frustrating…
How to let users change the data in Firebase and the dynamic component list?

But, I think this filter issue is another problem different from this, and that’s why I create a new topic again. Here is the background:

Used Extensions

  • JsonToDictionary
  • DynamicComponents
  • DateTools

Sample of the Real-time database
image
image

Blocks and UI

This Search screen (UI) allows users to view all the posts.
They can select district and venue (if they select district, they must select venue), or even select a specific date. Then, they press the ‘Find’ button to view the corresponding posts.
For example, users ‘Find’ ‘Central and Western’ and ‘AAA Sport Centre’, only Post 1 should be seen while Post2 should be invisible.

The 3 main tag_name (Yellow-circled blocks) in the database are:

  • district
  • venue
  • date

For the logic of the filter,
I think when users ‘Find’ the specific venue and date, those unmatched posts should be invisible.
But, I have no ideas what blocks I should use for them since I am not familiar with the blocks…

Could anyone help me to fill in the rest of the blocks (red circle blocks?)? Thank you :pray:

you should us give us some demo db else, see how can we test it… also you are using multiple tags… so create one demo project in firebase , add elements then share us… so you will get solution faster

I see. Thx!
I have input the link to this aia: FilterPost.aia (134.7 KB)

This is the demo project in firebase:

Here is the demo JSON in the database:

{
  "Post1": {
    "date": "02/12/2022",
    "district": "Central and Western",
    "fee": "$50",
    "level": "Intermediate",
    "playerno": 1,
    "playertotal": 2,
    "postid": 100001,
    "time": "13:00 -15:00",
    "username": "A",
    "venue": "AAA sport Centre"
  },
  "Post2": {
    "date": "03/12/2022",
    "district": "Central and Western",
    "fee": "$100",
    "level": "Intermediate",
    "playerno": 0,
    "playertotal": 5,
    "postid": "100002",
    "time": "15:00 - 16:00",
    "username": "B",
    "venue": "BBB sport Centre"
  },
  "Post3": {
    "date": "01/12/2022",
    "district": "Eastern",
    "fee": "$20",
    "level": "Intermediate",
    "playerno": 0,
    "playertotal": 2,
    "postid": "000003",
    "time": "17:00 - 18:00",
    "username": "C",
    "venue": "CCC sport Centre"
  }
}

Myself believe that you are complexing your self the app. I showed earlier a simple approach for your first query to have a simple design. But now you are go on with the available result which mean everything need to change totally.

That’s why we always say please ask properly.

You must use separate list for every tags then only it will function properly and you can use filter. Also you are looking for three filter , which mean you must go the filter 2 from the filter 1 result likewise you need filter 3 from filter then only you achieve the result.

Or you can use and logic three times with the event block of for each number from to by

If district with index 1 = district selc and
Date with index 1 = date picker and venue with index 1 = venue selection

Then with this number add items into a local variable and from this variable create the Dyna components

Don’t use contains text use select list item from the list block

Update

Please test this aia. I have tried to simplify your logics

FilterPost(1).aia (135.4 KB)

(PS: I filtered the items based on my selection- found working)

1 Like

Thank you super much for your help!!! :bowing_woman:
Your solution is so smart! I should simplify the logic that lets users select all those filters.
Now, I can successfully filter the post. Thank you again!

1 Like

I am so sorry again.
I cannot use the json extension since other extensions will be used in another screen later on, which reach the max (I should have a better communcation with my school teammates to do the project).
So, I need to change it back to use firebase components

BTW, why this extension?? Default kodular web block will do the job

Because I see some discussion using this extension to read data :pray: from the database…

And also, my app requires users to signup and login, so it is better to have authentication (not use web1).

I think I find some guidelines about how the database reads the data. Please give me 15 mins to try to figure it out by myself…If I still cannot, please help me :woman_kneeling:

Sorry, I am totally lost…
I try to read this discussion. (You are there @@)
How to get firebase database sub tag values list

But, it seems my schema template is not suitable for this(?), which I cannot find any similar examples… And I do not want to delete the blocks you made as they are still useful in my mind

Here is the aia. Please help me to change it to firebase. Thank you. :pray:
FilterPostFB.aia (153.2 KB)

I am sorry, still what you are expecting?

Filtered made… What else you want? pls convey it… I will try to solve now

If you dont want use it mean then use firbase component to get such value then from it take it values using dictionary method

Sorry, I know I am requesting too much.

Because of the authentication issue, I now need to use those firebase component blocks to get the value from firebaseDB, then generate the posts.

To be honest, your solutions work well. This is my fault for deciding to use web1 to get the value at first. :woman_kneeling:

hey it is so simple, what you are using as web url just put it in tag value just like this
image

if it is web url you will use www.abcx.firebaseio.com/Posting.json but in fb blcoks just call the value of Posting and move all the blocks from when web got text to when fb got value and make changes… simple

I try to change to this? But, it keeps loading…
Do I put it wrong?

Oh my madness. Instead of get value i suggested store value

I am terribly sorry

Use firebase get value tag (Posting )

It is fine~~~ Actually, I have tried to use get value…

but it gets errors instead :melting_face:
image

Pls check your firebase. Since we used store value, your previous values and all was replaced by empty dictionary… right now there be no data in FB

Pls create onceagain data’s in firebase and test.

Sorry for my bad move…

It is fine. I have now recovered the data in the database and changed the blocks to get value posting

But it still has the errors :melting_face:
image

What is happening to my aia…
FilterPost_FB (1).aia (151.3 KB)

FilterPost_F_1(1).aia (151.5 KB)

It takes only 5 min to solve your problem in Search Screen:smile:

If you use web , then you should get Posting Key value,
But if you use firebase get value, then you shoul;d get only the keys…

1 Like

Thank you very much! :pray:

1 Like