How do you cache/store a List of objects? (want to make app available offline)

Ok wonderful thanks very much for your assistance im looking into it, will get back with you shortly.

When i try to populate the records i get these which is suppose to look like this below.

Hi, looks like the records are getting created since the items are visible, but something is not right with the images. Does this happen online too or just offline? If offline, the reason is likely that the device cannot find the image resource based on an URL, because it’s not connected to the Internet. To show images in offline mode you would have to store copies of the image files themselves on the device.

Good day,

it is both offfline and online, something sems to be wrong with the previewer, i tried both repeated items and none repeated items. Even objects like text dissappears.

Additionally how would i get to store those images for offline ? any ideas.

It works now, i got the fix for it, it was the [Object Object] issue that was fixed with a formula.

IF(IS_EMPTY(current.fields.text),"",current.fields.text)

Thanks for your kind assistance.

Good information thanks for sharing
Telecommunication Specialist

1 Like

Hello Mari,
I need some guidance as well if you can help me.
I have (almost) done every step in this tutorial but still cant get the app to work offline.
I have an Airtable DB with a ‘Description’ and an ‘Image’ field.
I setup the LocalCache DB and the global app variables exactly like that of Airtable’s schema.
My problem is in the logic flow: maybe some nodes or flows have changed since this post was created.
Nevertheless, when I create a build and open the app for the first time, the app gets the relevant data from Airtable, then I turn of wifi, open the app but nothing is showing.
Under app info (in app settings, android) I can see that the Cache size is changed to some MB corresponding to the amount of data that was downloaded but I can’t get to show them on the relevant page of the app.

My question is: do I need to set up that one page to pull the data from LocalCache DB regardless if it has internet connection or not?
I don’t want to flood this post with relevant screenshots but if needed I can post them.
My app ID is: 205632

Thanks in advance

Hi @Edvin_Rushitaj! Sounds like the offline storage is working, but maybe your app variables are not being populated with the right values when the device is offline. What kind of logic do you have on the Global Canvas for that? The offline setup is a bit tricky to debug, since you can only really test it within the build. If I were you, I would add some alerts in the flows in some relevant places (for example to see if the set app variable node gets triggered, what is the content of the app variable, if your client-side record has the information you think it has, etc.), and try to rebuild the app to see where there might be a disconnect.

Hi Mari and thanks for your reply.
I’m attaching some screenshots, hopefully you’ll be able to help. I’m pretty sure I messed up somewhere but it’s so confusing for me that now I’m lost. :sweat_smile:

THE SCHEMAS

UPDATE RECORD

CREATE RECORD

GET RECORD

SET APP VAR FROM UPDATE RECORD

SET APP VAR FROM GET RECORD

SET APP VAR FROM CREATE RECORD

Your help deeply appreciated. :slight_smile:

Hi, one possible issue I can spot is that on the Global Canvas if Get Record Collection fails, you attempt to get “ThePark” instead of “TheParkCache”, so the app variable never gets set to “TheParkCache” in case the app is offline.

Ok, changet it to ParkCache. Indeed that makes sense.
I must have changed these settings a hundred times.
Do you see anything else?
On the page itself, do I have to pull the relevant info from park cache in this scenario?
(Its not showing anything because the cache doesnt work as it should, but i’ve connected the elements to ParkCache)

Hi, on the page itself you should use the app variable – the logic of the thing is that you have an app variable that populates either from local storage or from your online database depending on if the device is online or not, so you don’t have to worry about using different variables in the view components. :slight_smile:

I get it now. So on this relevant page, the data variables that I previously used (before the cache logic) are now obsolete, because I pull the data from page variables.
Now, are the app variables themselves correct? I’m almost certain that I’ve made a mistake.
(Can you see them in full res please?)

Hi, no there’s nothing I can spot, as long as you are setting the app variable after getting either the database or the client-side record you should be fine.

So, to close this thread (hopefully with success)
The binding types on the ‘Assigned Value’ in the App Variables must be the ‘Output value of another node’? (This is where I’m skeptical because I don’t understand it very well).
I will try generate a build now, to see where this is going.

Yes exactly, so what the “Get record” node outputs is the record that was just got. You want to use that output to set the app variable, as you have done. :slight_smile:

Mari thanks alot for your help and time. I hope I get this thing to work.
Thanks again

1 Like

I followed the instructions and by binding the Get Collection output to the App Variable an Error appeared. I was not able to bind a list of objects with 4 properties to the AppVar´s list of objects with 4 properties. I also tried binding them manually with a Formula but I couldn´t make it happen. I would appreciate very much the help as I´ve seen in the Forum´s questions great support from you. Thanks

Hi @Leonardo_Mosco, the incompatibility error comes up when the schemes of the two lists are not exactly the same. I would check again that all of the 4 properties in your objects have the exact same names and types.

Mari, Thanks a lot. It works! Sorry to bother you, right now the question just sounds silly even to ask.

1 Like