Hello, I am learning about “google chart example” features but I do not succeed to connect my page variable “chartData” which is a “list of lists of texts / numbers” to the data variables “Users_data_collection” I have tried the below functions but not working would you have some advices?
[[‘joueur’, ‘nb jongles BP’],MAP(SELECT(data.Users_data_collection,item.role==“joueur”),[item.prenom,item.T1JBP2021])]
Hey,
How is it not working, are there any errors in the formula editor?
Hi Cécilia, in fact the chart is not showing at all. If I replace ChartData by the data below then the correct chart is showing:
[‘joueur’, ‘nb jongles BP’],[‘Noah’,35],[‘Yoan’,50]]
Alright then there are a couple of things to try out:
-
Make sure that data.Users_data_collection
actually has content. You can do this by e.g. adding a text component with the ENCODE_JSON(data.Users_data_collection)
to see that you are getting the data you need
-
Your MAP function might be creating a list of lists, when you actually just need the inner lists. You can use REDUCE_INIT and WITH_ITEM to get rid of the outer list, something like:
[[‘joueur’, ‘nb jongles BP’], REDUCE_INIT(MAP(SELECT(data.Users_data_collection,item.role==“joueur”),[item.prenom,item.T1JBP2021]), [], WITH_ITEM(accumulator, item))]