Looping/Iterating Through External Data

Is there any way to iterate through external data once it has loaded to set local variables based on a field in the external data?

I want to set specific items in the experience with data from the external source but do not want to bind the data based on the location in the data source, which appears to be the default way of binding. If items are moved or deleted in the source data, binding based on location falls apart. The data I am receiving is from Airtable and will be updated by users. So I want to bulletproof it as much as possible.

I am really hoping there is the ability to do something like this code:

for each(var item:Object in externalData){
if(item.somePropertyName == “something”){
localVar.value = item.someOtherPropertyName
}
}

Sorry, typing out the code seemed like the easiest way to describe what I would like to do, since that is pretty much how I would do it if I could script it out.

Thanks!

BTW, my current solution is to have multiple API Explorer items with different FilterByFormula parameters to get the exact item I am looking for from Airtable. When loaded, I set a Global Variable to what I want.

This works well since I only have a handful of items, but I could see this getting very cumbersome with many calls if this amount grows. It would be great to have a scalable solution.

Hi @steve,

It’s kind of difficult to answer your question without a better understanding on the data structure and user scenarios that apply to your experience.
I’ll contact you directly so we can talk about this :wink:

For the community, some first ideas that come to my mind

  • You can “loop” through a data source by creating a “fake collection” (ex: carousel), outside of the scene, using a very simple template (ex: single Text asset) and using conditional triggers to evaluate some properties of the data source
  • If the business logic is more complex than that, then going through a Custom Interface Asset

Seb

1 Like

@Seb,

Thanks for the info and all of you help! I did end up creating an off-screen “fake collection” and that enabled me to put the desired data into the correct visual assets. I still have some testing to do, but initial tests, (like moving the position of the data in Airtable), do not break the experience. So I am encouraged!

I will definitely look into creating a Custom Interface Asset at some point, as I find it very intriguing, but it will probably be after I get this project completed.

Thanks again!

Steve

1 Like