Hi All,
Hoping I can get some help with the following:
Use Case
I have data that I’m retrieving from an external API (formatted as an array of arrays and working fine). I would like to take some of this data and use it in an HTML element to display a Google Charts Gantt Chart (Google Charts Gantt Chart).
Method
Initially I tried to just use dynamic data in the HTML element, but i need to use a ‘for’ loop to efficiently bring in all the data and I’m unable to refer to the [i]'th number of a list when referring to data in bubble (when [i] is a javascript variable).
so instead of creating the array of arrays that Google Charts needs within the HTML element, my new approach is to try and create the array of arrays within bubble elsewhere, and just pass that single object into the google chart AddRows function.
So here is what I’ve tried:
- Save data from external api as a custom state in the page index (the page is named “project” in this case)
- Create a new type of thing called “Gantt Chart” that has all of the fields that the Google Charts Gantt Chart requires.
- Create a list of Gantt Chart’s as another custom state in the page index. This is called “Index List Gantt Chart”. This is the object I want to pass into the HTML element once it is populated.
- Create a custom state called Gantt Chart Index Number (this will function as [i] normally would). I set this value to 1 after the page has loaded.
- Create the following Workflows:
Now before I tried passing the resulting information into my HTML element, I thought I’d test it in a repeating group first and unfortunately it isn’t working.
I think my problem is that I’m trying to use a ‘data’ workflow action to change properties of fields in a list that does not yet have any data in it, rather than using some sort of “add item to list” function. Is such a function available when working with custom states?
@mishav you’ve been super helpful in the past I wonder if you could also assist with this one?