Too many values (payloads) in data variable?

I’ve created a variable I’m using on a google chart, my REST call pulls back 7 days with 2 values for each day. When I attempt to build the variable with more than 4 days of 2 pairs each Composer starts running really slow, I get a browser prompt to wait for the browser to respond or exit the page. As long as I use 4 pairs or less then its fine. Suggestions on a better way to build this variable that is passed to the google chart?
Here is my example formula to build the json dataset:
[[‘Date’, ‘Lifted’, ‘Target’],
[‘Mon’,LOOKUP(data.mainChartData1[0], “totalliftedweight”),LOOKUP(data.mainChartData1[0], “totaltargetweight”)],
[‘Tue’,LOOKUP(data.mainChartData1[1], “totalliftedweight”),LOOKUP(data.mainChartData1[1], “totaltargetweight”)],
[‘Wed’,LOOKUP(data.mainChartData1[2], “totalliftedweight”),LOOKUP(data.mainChartData1[2], “totaltargetweight”)],
[‘Thu’,LOOKUP(data.mainChartData1[3], “totalliftedweight”),LOOKUP(data.mainChartData1[3], “totaltargetweight”)]]

Hi Joel, this could be done with list operations, but I was thinking that since there are only seven objects, you could first try replacing LOOKUP with this notation: ['Mon', data.mainChartData1[0].totalliftedweight, data.mainChartData1[0].totaltargetweight] to see if that already makes a difference?

I was thinking about it and if you had the list of weekdays saved in a page variable, you could do:

MAP(data.mainChartData, [pageVars.days[index], item.totalliftedweight, item.totaltargetweight])

And then to add the header row the final formula would be:

INSERT_ITEM_AT(['Date', 'Lifted', 'Target'], 0, MAP(...))

Thanks @Mari I will give that a try!

I did try this but it didnt help, it seems I’ve reached a limit on lines of code in the formula field. If anyone has any other suggestions I’d be happy to entertain like custom functions etc

Hi Joel, did you manage to solve this issue? What went wrong with the formula? The editor should be able to handle a formula of that size :face_with_raised_eyebrow:

Hey Mari I did not yet, it seems that if I add another record into the formula the editor starts hanging and I get “page not responding” messages. If I stay to only 4 records in the formula it works decent but slow. If I go to 3 it works normal. If I try 5 it basically hangs and takes 10 mins to make a change to the formula while the browser is struggling to do something

Is there another way I could push the values to the chart? Here is the formula currently:

[[‘Date’, ‘Lifted’, ‘Target’],[‘Day before that’,data.mainChartData1[0].totalliftedweight,data.mainChartData1[0].totaltargetweight],[‘Day before’,data.mainChartData1[1].totalliftedweight,data.mainChartData1[1].totaltargetweight],[‘Yesterday’,data.mainChartData1[2].totalliftedweight,data.mainChartData1[2].totaltargetweight],[‘Today’,data.mainChartData1[3].totalliftedweight,data.mainChartData1[3].totaltargetweight]]

Which is in a set page variable node.