Good Day folks,
I have a use case where I would like to return the number of records/ rows captured in a collection then return that value to other operations in my power app. My collection statement:
learCollect(
eventCount,
CountRows(colMassEdt_2a)
);
where colMassEdt_2 is a collection that captures records based on some other criteria. The output to the new collection eventCount:
I have placed a label to test the value returned but cannot get the value to show up. Here is the error:
As usual Im sure i am using a syntax wrong, but cannot figure it out. I would like to use the '52' from the collect statement in calculations and to display how many rows are present in the data table. Any guidance is appreciated.
When you use an expression such as
ClearCollect(
eventCount,
CountRows(colMassEdt_2a)
);
You are creating a collection with a single column that holds the value. You probably want to store the result of CountRows in a variable instead:
Set(eventCount, CountRows(colMassEdt_2a))
With that you should be able to use eventCount
in your label's Text property.
Another option is to use the expression CountRows(colMassEdt_2a)
directly in your label. This way if the collection is changed by some other operation the value of the label will be automatically updated.