Saving a local copy of data results from GET Collection

Sooo, I’m stuck again.

Basically my app gets data from a REST API and shows it through a list. The list, though is filtered depending on user so it only shows the data relevant to the user. Now, I want to save that filtered list output to my local device. Can anyone please point me to the right direction?

Basically I’ve tried adding a button with logic to create a record. I’ve already created by local data resource but I can’t seem to point the logic flow to the record. :neutral_face:

Basically:

REST Api -> List -> Apply Filter -> Save the filtered list results to local

Hi there!

What exaxctly do you see when you use CREATE RECORD flow function and try to point it to the variable containing the filtered data?

Hi Akseli,

This is what it shows:

I’m sorry I’m really having a hard time figuring this out. Is there any tutorial here on how to save data records from REST API calls to device? Because I can’t seem to “retrieve” the data values of my list item.

Have you tried assigning it with a formula? The binding editor can be very picky about compatibility, so you can try assigning with a formula binding instead, if you think the schemas should otherwise match :slight_smile:

I did try, but to no avail. To be honest, I might be a bit confused on the variables/data. Could you possibly walk me through an available tutorial on how to store list contents to local storage?

Sure!

So you already have a REST data resource. To store data locally on the phone you need to:

  1. Create a ‘client-side storage’ resource

  2. For the schema you can have for example:

id (text)
list (any value)

  1. Now by using CREATE RECORD you should be able to store the contents of the data variable into the list field of the client-side resource.

  2. The ‘id’ value you need to determine yourself. It can be static if you only need one of these records per user, or you can use the GENERATE_UIID formula function.

The data can be fetched with a single type data variable. In the example I’m storing and retrieving with a static id of 1.

Hope this helps!

Hi Akseli!

Sorry for the late reply, been trying to this but still no luck :frowning:

I can’t bind the list property to any list.

please see my video.

Hi! I can’t get your video to work, but for direct binding to work the schemas have to match exactly, so make sure that all the fields are correct type (text, number) and have exactly the same names.

Some of this can be circumvented through using a formula binding instead, but it’s better to fix the schema in this case.

I understand what you mean here Mevi, but so far, I still am stuck with this :frowning: by any chance can you direct me to a live working example so I can examine the app? Since there are very few examples of actual finished apps implementing this technique I have nothing else to compare to. I’m not quite good at this and coming from Bubble, this is a different learning curve for me.

Mmm we don’t really have those types of live example apps to share at the moment, unfortunately. But if you can take screenshots of the schemas of both the data and whatever else you’re using to set it (an app variable? page variable?) I’ll see if I can direct you to what doesn’t match as of yet.

You might be interested in the Replace client-side collection flow function, available via d3uPDjEYX1EzXauHs0uAvQ token from the marketplace (and search too).