Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Performance tuning in Canvas Apps Power Apps using Caching & Concurrent

Performance tuning in Canvas Apps Power Apps using Caching & Concurrent

Canvas App changed the way we design mobile applications. We can easily configure Canvas Apps by connecting multiple data sources in a minute. But in the configuration journey we have to keep the app performance point into consideration otherwise the app performance will be very slow.

In this post I will discuss 2 important performance tuning factors.

Caching Data Sources

Very often in our canvas app we query the same data repeatedly, like in the case of pulling the lists of skills for our drop-down menus. In those scenarios, we can query for the data once and then reuse that data throughout the app which will reduce the repetitive calls to the data source across the network.

The following is an example of this scenario.

In our app, we have multiple screens where we provide a drop-down menu for selecting the skills. The list of skills is kept in Microsoft Dataverse in a table named SkillTable. On each instance of the menu, we use the following formula.

Filter(SkillTable, Status = "Active")

There is no issue in the formula but when we call this expression multiple time in our app the data load every time although the data is static so we could modify our app to create a collection with the OnStart property of the app that stores the information using the following formula.

Collect(collectSkillTable, Filter(SkillTable, Status = "Active"))

Now we can change the Items property of the drop-down controls to be  collectSkillTable instead of Filter(SkillTable, Status = “Active”). These small changes add up to increase performance in our app.

Using Concurrent function to load multiple data sources

In certain scenarios we use multiple Collect statement when we want to load multiple data source the formula may look like as below:

Collect(collectSkillList, Filter(SkillList, Status =
"Active")); Collect(collectCompanyList,
CompanyList);Collect(collectRegions, RegionList)

In this example, we are creating 3 collections, but the collections are processed one at a time. So if each one takes 2 seconds to process then the users has to wait 6 seconds for the app to start.

The Concurrent function allows us to process all of those calls at the same time. We can change our code to the following.

Concurrent(
Collect(collectSkillList, Filter(SkillList, Status = "Active")),
Collect(collectCompanyList, CompanyList),
Collect(collectRegions, RegionList)
)

Now all three formulas run at the same time. Reducing your load time to 3 seconds. Concurrent is a great way to avoid long delays from asynchronous calls.

Hope this helps.

Follow my blog for more trending topics on Dynamics 365, Azure, C#, Power Portals and Power Platform. For training, Courses and consulting, call to us at +91 832 886 5778 I am working more for community to share skills in Dynamics 365 and Power Platform. Please support me by subscribing my YouTube Channel. My YouTube Channel link is this : https://www.youtube.com/user/sppmaestro

You can enroll now !We are giving 30% discount on our Internship Program

Don’t miss the chance to participate in the upcoming Internship Program which will be done using Microsoft Dot Net Web Development Full Stack Technology. The new batch will be starting from May 20, 2024.  We will have most experienced trainers for you to successfully complete the internship with live project experience.

Why to choose Our Internship Program?

Industry-Relevant Projects
Tailored Assignments: We offer projects that align with your academic background and career aspirations.
Real-World Challenges: Tackle industry-specific problems and contribute to meaningful projects that make a difference.

Professional Mentorship
Guidance from Experts: Benefit from one-on-one mentorship from seasoned professionals in your field.
Career Development Workshops: Participate in workshops that focus on resume building, interview skills, and career planning.

Networking Opportunities
Connect with Industry Leaders: Build relationships with professionals and expand your professional network.
Peer Interaction: Collaborate with fellow interns and exchange ideas, fostering a supportive and collaborative environment.

Skill Enhancement
Hands-On Experience: Gain practical skills and learn new technologies through project-based learning.
Soft Skills Development: Enhance communication, teamwork, and problem-solving skills essential for career success.

Free Demo Class Available