
Announcements
I have this function:
ClearCollect(
colCWTest,
{Result: "All"},
Filter(
KPI_ServiceDesk,
Year = dd_year.Selected.Result).Text(CW)
)
)The Filter of course does not work with .Text(CW). Only when I do .CW (without Text). But how am I able to get CW (which is numeric column inside a list) converted to a text?
I also tried
ClearCollect(
colCWTest,
{Result: "All"},
Text(Filter(
KPI_ServiceDesk,
Year = dd_year.Selected.Result).CW)
)
)but that does not work either.
It appears that you are trying to add an "All" option to a list of filtered choices. If so, then your formula is not matching the record schemas properly. You would have ended up with a collection with a Result column that would have a value for the first record and then the remaining records having values in a CW column.
Not sure of your purpose for the collection, but if you are using this for a dropdown or other items property of a control, then you can change your formula to the following:
Ungroup(
Table(
{Items: ["All"]},
{Items: RenameColumns(Filter(KPI_ServiceDesk, Year = dd_year.Selected.Result).CW, "CW", "Value")}
),
"Items"
)
You really don't need to worry about the conversion to text as it will all result in text anyway, but if you do specifically want to convert, then change the formula to the following:
Ungroup(
Table(
{Items: ["All"]},
{Items: ForAll(Filter(KPI_ServiceDesk, Year = dd_year.Selected.Result).CW, Text(CW)) }
),
"Items"
)
NOTE: the above formulas will produce a table with single column records. The column name will be Value.
If there is some need to duplicate all this data in your app memory into a collection, then just use either of the formulas above in a ClearCollect function.
Ex:
ClearCollect(colCWTest, <eitherFormulaAbove>)
But again, if this is for some Items property, then you need not waste the effort on making a collection...it's just overhead!
I hope this is helpful for you.