Adventures with Power Platform: Sample Timesheet Canvas App

I wanted to create a Canvas App that took a list of Time Transactions and showed them in a matrix format by Task and Duration.

I also wanted to edit the data. ✏️

If you want to see it in action in your Environment, download it at https://mattruma.com/wp-content/uploads/2024/09/TimesheetSolution_1_0_0_0.zip.

Let’s breakdown what I have in my OnStart event in my Canvas App.

I set gblStartDate to the date of first day of the current week, and then I set gblEndDate to the date of the end of the current week. 📅

I create da dummy set of data, I am just using a Collection, but this is easily be replaced with a SharePoint or Dataverse data source. 🔨

I then created a Collection of distinct Tasks, based on the Task for each Time Transaction.

And finally, I built the Matrix based on the Collection of Tasks.

From there I start building the Canvas App.

Figure 1 – Canvas App

I won’t bore you with all the details 🥱, but a couple of things to call out.

In the Text Inputs that will show the Duration for each Day, I added code to the OnChange event to update the Collection with the edited value.

Figure 3 – OnChange event

I totaled up the Duration for each Task into a Text Input.

Figure 4 – Power FX code to sum Duration by Task

I totaled up the Duration for each Day into a Text Input.

Figure 5 – Power FX code to sum Duration by Day

To sum up the Duration both by Task and Day, I summed the values of the Text Inputs.

Figure 6 – Grand total for Duration

I added buttons for Add Row and Delete Row, and one more for Save Changes, the latter for persisting to an external data store.

That was really all it took to create an editable Matrix!

Figure 7 – Timesheet Canvas App

Check it out for yourself at https://mattruma.com/wp-content/uploads/2024/09/TimesheetSolution_1_0_0_0.zip. 👀


Discover more from Matt Ruma

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *