Hello.
I have some problem when try to make statistic and define Primary value. I can't work with array methods as described in the documentation Array methods
For my example I used Learn with an example app in the main part Welcome to Retool page and fixed Avg seat cost statistic component.
I want to filter all values with simple validation. For example
This query works fine:
It looks like your transformer is returning an array, that would also make sense with the error you're seeing since an array has the 'object' type: The value has to be of type 'number', you provided a value of type 'object'
Can you try returning filtered[0] instead of filtered and let me know if that works?
I made request: {{formatDataAsArray(activeCustomers.data).filter[0](row=>parseFloat(row.avg_cost_per_seat)!=parseInt(3))}}
And got warning: formatDataAsArray(...).filter[0] is not a function
and tried with filtered
request: {{formatDataAsArray(activeCustomers.data).filtered[0](row=>parseFloat(row.avg_cost_per_seat)!=parseInt(3))}}
warning: Cannot read properties of undefined (reading '0')
The entire expression data.filter(row=>parseFloat(row.roomid)!=parseInt("3")) should equal an array, same with formatDataAsArray(activeCustomers.data).filter(row=>parseFloat(row.avg_cost_per_seat)!=parseInt(3)). So whether you store it in a variable first or try accessing the index right away the call to the index should come at the end.