Reading Cloud Data in App Lab

#1

I’m not sure if this is the correct forum for this question, but I will give it a shot…
I am using a data table to store an array from use to use. The array successfully stores into a single cell! of the table, but when I go to retrieve the data, all of the indices of the array return ‘null’. It sees correctly that there is an array, and it sees how many objects are there, but the array is essentially empty. Any thoughts on how to fix this or how to better solve this problem would be greatly appreciated. Screenshots provided as well as a link to the app.
These three shots show the data in the table as an array, the result of trying to read the data through a console log, and the code block that I created to retrieve (and read) the data.

35%20AM
My goal is to be able to store the data when using the app, and then to quickly retrieve a collection of data when the app is opened.State Plate Game

Importing Data from Website into App Lab
#2

Sight unseen and without going to test myself, and based on knowledge with some cobwebs on it… I think you might need to make use of JSON.stringify() and JSON.parse()

The data table isn’t really meant to be able to dynamically store multi-dimensional data. But a cell with an array in it is just that. So a way around this is to flatten your arrays into strings using JSON.stringify(someArray) before storing in the table. And then exploding those strings back into javascript arrays using JSON.parse(someString) on the way back out.

Here’s a console transaction showing how it works.

> var b = [1,2,3,4]
undefined

> flat_b = JSON.stringify(b)
"[1,2,3,4]"

>JSON.parse(flat_b)
(4) [1, 2, 3, 4]

See if that works?

–Baker

#3

Baker,

You rock! That was a perfect solution for my needs.

Chad