Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

OnStart code efficiency review

(0) ShareShare
ReportReport
Posted on by 345

Morning all,

 

I was hoping to check if this is the best way I could be running this OnStart code to speed up the load of my app:

 

 

//Icon table for SVG icons
Set(Icons, IconTable);

Concurrent(

//Variables to be reset
Set(suggested, Blank()),
Set(glossarySortOrder, Blank()),
Set(areaCat, Blank()),
Set(selectedItem, false),
Set(glossary, false),
Set(infoPane, false),

//SVG Icons
Set(pbiIcon, LookUp(Icons, "pbiIcon" in IconName, IconLink)),
Set(updateIcon, LookUp(Icons, "updateIcon" in IconName, IconLink)),
Set(mailIcon, LookUp(Icons, "mailIcon" in IconName, IconLink)),
Set(pageIcon, LookUp(Icons, "pageIcon" in IconName, IconLink)),
Set(staffIcon, LookUp(Icons, "staffIcon" in IconName, IconLink)),
Set(saveIcon, LookUp(Icons, "saveIcon" in IconName, IconLink)),
Set(homeIcon, LookUp(Icons, "homeIcon" in IconName, IconLink)),
Set(downIcon, LookUp(Icons, "downIcon" in IconName, IconLink)),

//Colour palette
Set(skyBlue, ColorValue("#0079BB")),
Set(lightBlue1, ColorValue("#CCE7F6")),
Set(bgBlue, RGBA(241,244, 249, 0.8)),
Set(itemGrey, ColorValue("#D6DFEE")),
Set(bgGrey, RGBA(167, 182, 203, 0.56)),
Set(headerBlue, RGBA(0, 121, 187, 0.81)),

//Alphabet table for Glossary
Set(alph, AlphTable),

//Area Filter table
ClearCollect(
 areaFilters, 
 {Area: "Home"},
 {Area: "Staff"}, 
 {Area: "Students"}, 
 {Area: "Report"}, 
 {Area: "Page"},
 {Area: "Add Item"}),

//FAQ Dataset
ClearCollect(
 faqCol,
 Filter(
 'FAQ Dataset',
 Status.Value = "Active")),

//Items updating soonest
Set(
 calendarCol,
 FirstN(
 AddColumns(
 Filter(
 GroupBy(
 SortByColumns(
 Filter(
 AddColumns(
 Calendar,
 "_FAQname", 'FAQ Item Name'.Value
 ), Month >= Today()),
 "Month", Ascending
 ),
 "_FAQname",
 "FAQs"
 ),
 !IsBlank(_FAQname)
 ),
 "MostRecent", First(FAQs).Month,
 "Details", First(FAQs).Name1
),
3
)));

//Attachments Collection
ClearCollect(preImageCol, 0);
ClearCollect(
 imageCol,
 Filter(
 Ungroup(
 ForAll(
 Sequence(
 CountRows(faqCol)),
 Collect(
 Test,
 Last(Test).Value+1);
 {
 Image:Last(FirstN('FAQ Dataset',Last(Test).Value)).Attachments,
 ID:Last(FirstN('FAQ Dataset',Value)).ID
 }),
 "Image"),
 !IsBlank(Id)))

 

 

For info, the Alph and Icon collections are drawn from Excel tables uploaded as static tables to reduce the load on the App and to remove ghastl

 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,948 Most Valuable Professional

Leaderboard