Hello,
What I am trying to do is to show in a TextBox the number of records of a table that is shown in a Gallery control. This table is stored in an update context variable that it can be modified with Filters if some conditions are true.
For example, in the property "OnVisible" of Screen1 I do:
UpdateContext({table1:'Table of records'})
Then in the property "Items" of my gallery control I do:
table1
And finally in the "Text" property of a textbox I just do:
"The number of records is: " & CountRow(table1)
The records are shown in the gallery control but I don't see the number of records in the textbox control.
Thanks in advance.
Regards,
@Meneghino wrote:Hi @Brank
The correct syntax is CountRows, with an s at the end.
Is that the issue?
Hello,
I wrote the syntax incorrect here, but in my application is correct so that isn't the issue.
Thanks anyway.
Hi again, it seems to work for me.
Here is what I did:
UpdateContext({Test: CustomGallerySample})
CountRows(Test)
PS Frankly I didn't think it was possible to set a context variable to be a table, so I am surprised this works at all. Usually you would use a collection for this. Any comments from the PowerApps team would be appreciated.
PPS You can even set a context variable to be a record (i.e. by using the First function), and it recognises it as a record type variable. I was looking for how to do that for a little while, so thanks for stimulating the discovery!
Hello @Meneghino,
Can you try to do that example but using a Common Data Service entity as the Data source instead of using the table example giving by Powerapps?
Thanks in advance
Regards,
Hi @Brank
I confirm that it does not work. But it works with a simple work around, the button OnSelect should be this:
ClearCollect(PersonColl, MyCDStable); UpdateContext({Test: MyCDStable})
Then CountRows(Test) will give the correct result, assuming MyCDStable has less than 500 rows. But you can work around that also.
I have noticed in PowerApps that if something does not work directly with the source, but it should, then it will probably work with a copy of the source in a collection. And it will work much faster!
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
211 | |
204 | |
82 | |
58 | |
38 |