One of the first lessons when getting to grips with Canvas Apps was that you should always use Collections where possible to reduce the number of calls to the original data source, and with any luck, you may see a performance increase as a result too. However, I often find that the data source I’m using always collects a number of columns that I am never going to use in the Canvas App itself.
Let’s take the example of listing Account records from Dataverse using a simple Power Fx statement:
As you can see below, there are a significant number of columns that I don’t plan to use relating to various relationships across the Dataverse database.
These columns are extremely important for the database and we shouldn’t underestimate their criticality, but these are not necessarily important for me when building a Canvas App as I just want to retrieve the Account Name and the Account ID.
We can make a small change to the original Power Fx statement, by expressing exactly which columns to use, such as:
ClearCollect(ListOfAccounts, ShowColumns(Accounts, "name", "accountid"));
Which in turn produces a Collection that is much more refined, shown below.