Referencing Data Tables in my app – recommend an approach?

A question from someone who has no general coding or development background but who has had fun so far (and learnt a lot) getting my prototype app working.

My app has a timer (i.e. stop watch…) on certain pages and I have various components that display metrics depending on the timer value which generally starts running when a page is opened…and the value for these metrics sit in a table which I reference with functions. It is a simple table – ~300 records, 6 columns.

I have imported the table as a Data Variable a few different ways (Airtable, Firestore, etc - see the detail below under ‘What I have done’) but thought it worth asking if I am going about this the right way?

Is there a better way to do get the data into the app? Perhaps have it in there ‘permanently’ rather than importing it each time a page is opened?

When I originally tested my approach and functions, I used various Page Variables…but it looked to me as if that functionality is not appropriate for holding a table with 300 rows…and only one column of my table was possible per variable…but it was all learning.

With an API and pulling the table and storing it as a ‘Data Variable’, how does that work in basic terms? I assume the data variable is populated each time the page is opened because I don’t have any user actions that prompts it? And I assume the Data Variable is cleared when the page is closed, as my usage on Firestore UI indicates I am calling it each time the page is opened? Is there a way to import the table once as a ‘Data Variable’ and have it saved in the app?

I have seen mentioned on the forum that Appgyver is developing its own database functionality…I think that would simplify my world, but not sure when that will be released. And I sort of have this, perhaps petty, desire of using Backendless rather Google Firestore but I actually have had success with Firestore with the table…

What I have done;

  1. tried to figure out how to store the table on appgyver but eventually came to the conclusion the data functionality is more geared towards the app user creating records, rather than storing static data that underpins the app
  2. used Page Variables with Variable Value Type = List to test functions but these cannot store a table…
  3. used Airtable – easy to go from Excel to Airtable with the data and got everything working with an API but ran into the pagination issue
  4. used Airtable but this time with http request…almost got it working (lots of help from the forum) but gave up for a few reasons
  5. used Firestore as it is easy to get around the pagination issue…but getting the data into the database took some time…but it works 100%. But I am now paying for usage which may become an issue if the app is popular
  6. now trying Backendless for authentification and a few other things, so looking at their database and have run into the pagination issue again…I liked the idea of using Backendless for everything but not sure I want to go down the pagination rabbit-hole again.

Hi Paul! You can see the logic for data variables if you open the Logic canvas when you are in the variables view.

Here’s the default behavior of a data variable:

So when the page is mounted, the data gets retrieved from an API, and set to the data variable. Then a delay (5000 ms by default) is triggered, after which the data is fetched again. As you pointed out, this supports the creation, deletion and updating of records as an updated “snapshot” of the data gets fetched every time the page is opened and then every 5000ms.

In your case, I would say the best way to fetch the underlying dataset from an API only once when the app launches is by doing it on the Global Canvas page. The Global Canvas has an “App launched” event on its Logic canvas, after which you can use “Get record collection” to fetch the data, similarly to how the logic of a data variable works. To make the data you just fetched available in your app, you can create an app variable with a scheme matching that of your data resource, and use “Set app variable” after “Get record collection”, setting the output of the previous node as the app variable’s value.

Thanks for that Mari.

I was stuck previously on getting a Data Source into a Page Variable rather than a Data Variable but I can see right now I can match the schema if I use type = ‘Object’. Not sure what I was selecting previously,


1 Like