I want a page in my app to start loading as soon as the app is launched, because it has lots of data. How can I do this?
Run the data loading functions on App Launch, store as App Variables, and then display a loading icon of some kind. Once the App Variables you’re looking for have loaded, render the main page by taking off the loading icon (and opening the page you want, if necessary).
Do I do this on the global canvas, because I can’t figure out how to get the “on app launch” event on the logic of a regular page?
Thank you so much for the help, but I can’t figure out how to set the data I get from the backend to an app variable.
I tried getting the record collection then setting the app variable (one which I gave the same properties as the get record collection), but no data shows up when I do that. Do you have a suggestion?
Do you know if I can set the data variable for the page, from the global canvas?
You cannot set Page Variables from Global Canvas, no. But, you can set App Variables.
Take a look at what the backend is returning to AG by using the Test option under the REST call you’ve created.
If a Test is returning data correctly, then check the Schema (and maybe use the option that lets you set the Schema from the Test results): be careful to match variable types, because AG uses non-standard variable typing and is very picky about those variable types when you go to use them in your app.
My biggest problem with this has been matching REST calls with properly-typed schemas and, then, ensuring that the schemas properly match both the App Variables (and associated typing) and the way in which your app using them (e.g. does a field in the app expect “Number” and your variable is “Any Text”?)
Thanks, but the “get collection” isn’t working on the global canvas. I even copied it from a page and pasted it in the global canvas, but still nothing. I tested it using a toast if the "get collection: failed, and it failed every time. Does it also fail for you?
Try running it as Get Record
and then customize the call to pull whatever you want.
I use Get Record
to pull all kinds of things, instead of Get Collection
.
Thank you very much.