a!columnChartField( label: "Année", labelPosition: "JUSTIFIED", categories: a!forEach( items: local!periodes[local!selectedPeriod].weeks.week, expression: "S" & fv!item ), series: a!forEach( items: local!uPerWeekPeriode, expression: a!localVariables( local!cBrandId: fv!item.cBrandId, a!chartSeries( label: fv!item.cBrand, data: if( contains(fv!item.cBrandId, ri!selectedUs), fv!item.uPerWeeks, {} ), links: a!forEach( items: local!periodes[local!selectedPeriod].weeks, expression: a!dynamicLink( saveInto: { a!save(ri!filteredYear,tointeger(fv!item.year)), a!save(ri!filteredWeek,fv!item.week), a!save(ri!filteredStatus,cons!STATUT), a!save(ri!filteredCBrand,local!cBrandId), a!save(ri!displayPList,true) } ) ) ) ) ), yAxisMax: local!topAxisUb, stacking: "NONE", showLegend: true, showTooltips: true ),
I wanted to filter the chart to display only "selected Us". In othrer words, only contains" selected Us".
Discussion posts and replies are publicly visible
As a best practice, whenever you are using comparision functions like contains() and wherecontains() always typecast them. Especially when you are dealing with local variables because they wont have any datatype by default. In the above case, you can rewrite the above contains logic like this (assuming they are integers):contains(
tointeger(index(fv!item, "cBrandId", "")),
tointeger(ri!selectedUs)
)