Will this problem be persistent when I build the app too?

When I connect using AI companion, the first time I click feed fish btn it doesn’t fetch data from Firebase DB (in retrieve_preset_schedule function , it just goes to else part straight) but subsequent press of the btn seems to fetch data properly. I tried to go to another screen and come back again and it’s the same, first press just does not seem to get the data!

Is it a bug, or is my way of coding wrong or is it just like a limitation of using the AI companion?
(for eg. when I try to navigate from screen to another and back to the first sometimes the companion would just close, but after building the app it worked well, is this similar to that!)

I have attached relevant blocks and a clip showing the same! pls ignore the connect, increment btns it’s just for testing other stuff! global check_schedule is set to false initially so that the checking will only happen when once per 2 clicks i.e. while closing the drop down(?!) it doesn’t try to check the preset schedule.


Hi Somasundharam_Sampat

  1. The first line of feed_fish.click is rather odd - what is it supposed to do?

  2. re the procedure retrieve_preset_schedule how does the variable preset_schedule_no get assigned it’s value? That would be the most obvious area of concern. You could use “Do It” (right mouse click on item of interest) to see what the value is at that moment in time when running in the Emulator.

Hello @ChrisWard

  1. Regarding global check schedule : If you see the clip, I have designed the feed fish btn to show/hide 2 other btns after each click. Since there was no need to check the data base when I was hiding the above said 2 btns, I initialized a var global check_schedule to false so on the first click it would become true and the if block will get executed but when I hide the btns(on 2nd click ) it turns to false and ```if```` block does not get executed

  2. Regarding global preset_schedule_no : It is assigned the value of tag: SCHEDULE DETAILS/SELECTED when FirebaseDB1.GotValue event is trigerred ! (I should have added those blocks too, since i was adding a clip, I thought there wouldn’t be enough space, so attaching them here).
    fdbd error1

Please export your project and post it here.

1 Like

Hello @ABG,

Thanks for your interest and time ! Here is the .aia file.

I was just about to post, that i was able to solve it, but since you wanted to have a look, I thought It’ll benefit me as I am still new to this, would love to hear your thoughts.

I have uploaded the modified one, I think it was a latency(i don’t know if its the right word) problem. Thanks to @ChrisWard for suggesting to use Do it option, I found the firebase.gotvalue did give the expected value to global preset_schedule_no but that variable was not updated in the retrieve_preset_schedule and used to the value that I initialized it with. I have made amends by changing some blocks, I hope it is readable.

Please do have a look and suggest some improvements!

Thanks a lot again!

EDIT: .aia file attached now is the appropriate one; there are some trivial mistakes in the older one, sorry to have made you waste some unnecessary time!
Aqua_farm (1).aia (222.6 KB)

This is a big app, bigger than I can fit between my ears.

I was able to notice one little validation order bug here in Screen1 …

You check if response > 100 before you check if it is a number.
The order is wrong.

This app is a result of continuous addition over the last two weeks, so thanks @ABG, for taking your time and pointing out some caveats! Really appreciate it! I hope you looked at the most recent upload of the .aia file. In this Screen1 and Screen3 are complete (in my opinion ! :slightly_smiling_face:) So I’d be happy if you can look at them the next time when you’re free !! :star_struck:

Thanks again !

You did not fix this.

The edit part of that reply was uploaded before your reply! I have made that changes here, and have made amends for similar instances else where in the file.

Aqua_farm (2).aia (225.9 KB)