Fire-base showing erratic response in different bucket names

Please help me…
In my project i am trying to take data from Firebase by changing bucket values…

pic1 Global Worker_list…is a dynamic list contains DB bucket names. This may contain more than one items…

From this list i am trying to collect data by changing the bucket names using the block “for each name in list”…

blocks (2)

Every time…i will change the bucket name, and get tag list, then filtered some item from taglist and collect the data of that tag…

Problem is…
If Global Worker_list contain only one item ever thing is working fine…
If Global Worker_list contains more than one item some unexpected quantity is getting as data…

My blocks are given below
blocks (3)

blocks (4)

blocks (5)

i am suspecting that…
the loop using “for each name in list”. is completing the loop before waiting to get the value of tag list and data value (The result of other two blocks)

please help me

I can’t understand where the error is (this time)
can I suggest you any changes ?
If when app start you store all the tag and the values in tiny db.
Next read tiny db, set tag and values in two different lists. you would not need to read firebase continuously.

Thinks about the future, with many user in your app this happens:

1 Like

Thank you for your response & suggestion…

After two day research on this problem i came to the following conclusions.

  1. While calling the method “Get Tag List” the block will send a query to DB and proceed further, It will not wait to get data from DB. This will trigger the event “When DB Tag List” and so on.

  2. Provided the method is not waiting it will continue for 2nd and 3rd cycle of loop.

  3. So loops by the method “for each name in list” will go on continue and finish.

  4. While executing the event “When DB .Got value” of the first query, the bucket value might have changed by the loop operation. (Reason 1,2 &3).

  5. So the global variable “global Search_data” will get non related bucket value along with some other data…

These are only my conclusion…

i am not sure…

If this conclusion is right, try to modify Kodular with a suitable block, which will wait for the result of first DB query and proceed accordingly.

Your suggestion TinyDB is good…

Thank you

My assumption was right…
As per that conclusion i tried the following blocks & i succeeded…
i used a “Hidden_search” button…(Visibility disabled button)

Global count is a variable which contains number of DB bucket items, which is used to control the loop.

blocks-3

blocks -1

Now i got the result as what i expected…

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.