Trying to make a complex calculator

Hello everyone.

This is my first time using Appgyver so Ill try to give out as much info as I can.

I have connected a firestore database and I can pull/display data.

What I want to do is bind the data in an App (local) variable so I can do some calculations ( if there is no internet)

something like:
local_ price_1 = firestore_price_1
local_ price_2 = firestore_price_2

etc.

any help would be greatly appreciated

Hi @John_Dalezios, app variables only persist until the app is closed, so you’ll need to save the values to the device if you want to access them in offline mode. If the values you want to store are fairly straightforward (like numbers), I recommend using the “Set item to storage” and “Get item from storage” flow functions from the marketplace.

This tutorial explains what kind of logic you need to make it work – there has been a change to the implementation of on-device storage and doesn’t let you choose the ID yourself anymore, that
s why I recommend the storage flow functions instead. :slight_smile:

One more thing that might be helpful to you is the systemVars.networkStatus system variable, which will tell you if a mobile device is online or not. You can use it in an If condition flow function systemVars.network Status == 'cellular' || systemVars.network Status == 'wifi' to see if the device is online. Another way is to try to get something from Firebase, and if it fails (flow’s 2nd output gets triggered), use the local values instead. :slight_smile: