Share data variable between pages

I have a page that has a list of people, but I have another page where I am adding people, but I do not want to add the same person twice so I do a check in the data variable … but this means I need the collection of people in both pages, I need 2 data variables, and I need to remember to keep each updated.

Is there a way to have a data variable shared between pages?


All of this is coming because I want to make the ID of the list the person ID, but I am forced to use the internal ID for uniqueness. Is there a way to make the person ID the real key?

Hello,
Perhaps use the app variables rather than page variables.

Yes, but isn’t the entire methodology to retrieve data from data resources, and place the data into data variables?

Your list of people is in a variable app. With :

  • people
  • Visibility true/false
    And you choose who appears or not.

But don’t I lose the whole schema I get with data variables?

The problem with the data variables is they are only valid in the scope of one single page. They behave exactly the same as page variables. In order to address your business scenario you might want to implement your data acquisition logic in the global canvas page and assign the payload directly to an app variable. I hope that helps; kind regards;Piotr

PS. just make sure you assign the get collection payload directly to an app variable. if you wanted to assign it first to a global canvas page data variable there is a reported bug pending a fix:

But don’t I lose the whole schema I get with data variables?

Unfortunately, you do not get the schema definition as with the data variables. (You might still want to recreate one manually though). However, if your app variable is of “Any type” type and the payload of your API is json formatted then it will all click as “any type” means “raw json”. So you will be able to address any value of your json payload using the app variable name as a root. On a side note, If you had a look at the built-in HTTP request function flow you will see it offers raw json outputs so you can bind them to “any item” typed app variables. I hope that helps. kind regards; Piotr

PS. If you still want to use data variables on a global canvas page please upvote the bug item: With the 4.x runtime the global page does not load data into a collection variable | Voters | AppGyver

This issue of data variables having the scope of page variables should be treated as ‘known bug’, and IMHO a pretty significant bug. For those of us who are using firebase, it means we will have to go through the huge pain to create the schema manually on the app variables, or get ready to pay google for the bandwidth.

It’s quite fortunate that AppGyver team doesn’t see it that way. The solution/workaround seems to simply provide the mean to export the data variables’ schema and import them into the app variables.