I’ve got a specific use case that I think I need to make a plugin for, so I used ChatGPT… It works fine if I run it outside of Bubble, but returns 0 in Bubble.
set_field is a list of Thing ‘set’ with attributes ‘daynumber’, ‘load’, and ‘duration’.
volumeSums is the exposed state, a list of numbers.
Yeah I had tried a bunch of different ways - maybe my brain is just fried.
For overall context,
I have ‘sets’ with ‘duration’, ‘load’, and ‘daynumber’.
I want to calculate ‘volume’ per ‘daynumber’, which is the sum of each ( ‘sets’ * ‘load’ ) for each day.
However doing that with Toolbox, I would have to use group by day prior to doing the multiplication to get the same result.
Or using ListItemExpression, I theoretically could refer to the previous item in the list to check and see if the set is on the same day to sum, but ListItemExpression only looks at list items in isolation.
As for Run JS, the goal is to have this data feed into a graph that would change when data changes, and I can’t get it to update regularly.
Yup ChatGPT does not know Bubble. Right off the first line ChatGPT both fails to get the properties of list correct nor did it use idiomatic Javascript Array.reduce(). Also volumeSums is probably more clearly named dailySums:
Thanks for the response, I’ve been playing around with it and trying to figure out Bubble syntax by looking at other plugins, but I’m missing something. Also not familiar enough with JS for .reduce
This is what I’ve got (much thanks btw), but it throws an error ‘sets is not defined’ - But it looks defined to me?
Also how do people test their code in this format outside of Bubble?
You’ll be interested in this video and my whole thread (but no, my training prompt for GPT4 isn’t available yet and you do still need to know what you’re doing, but I have created plugins using GPT4 as my co-developer):