web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Code doesn't execute o...
Power Apps
Answered

Code doesn't execute outside the studio

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I have piece of code that creates collection from filtered database and counts the rows to create count and percentage of employees working for each day of the week.

ClearCollect(CL_Percentages, Filter(Database_List, Week=ddWeekNo_Admin.SelectedText.Value, If(ddDepartment.SelectedText.Value = "All", true, Department.Value = ddDepartment.SelectedText.Value)));

Set(Total, CountRows(CL_Percentages));

Set(MonCount, CountRows(Filter(CL_Percentages, Monday.Value="Working")));
Set(MonProc,Round(MonCount/Total*100,1));

 

The code continues for all days of the week. I have this code in three places:

  • "ddWeekNo_Admin" dropdown in OnChange;
  • "ddDepartment" dropdown in OnChange;
  • "Admin_Menu", the screen where it all takes place in OnVisible

If you change one of the dropdowns the code executes without an issue, everything is calculated. However the Admin_Menu part, where the code was supposed to be ran for the first time just refuses to work. I even tried applying this code to other controls such as on App OnLaunch, the button leading to that screen and a timer with 1s delay after showing that screen.

This issue appears when using the app on phone. Other users also reported it happening on their PCs.

Categories:
I have the same question (0)
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Do you mean the codes can't be triggered properly in Screen.OnVisible property and App.OnStart property?

    In this case, I prefer the issue is caused by Preview Features and Experimental Features Setting in App Studio.

    Please try to toggle off all experimental feature and the following Preview features that may cause this issue.

    Snipaste_2020-09-03_14-50-35.png

    Hope this helps.

    Sik

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I mean that the code doesn't execute specificaly outside the App Studio.

     

    App Studio has no issues and code works perfectly. However if I run the app through my phone or MS Teams it fails.

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Regardless of devices, the Apps always run in the PowerApps studio.

    Does that above workaround make sense for your case?

    Sik

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That worked, thanks.

    Apologies for not trying this and coming straight to conclusion.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 308

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard