cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
priyankbhat
Helper III
Helper III

Custom method/function for avoiding repeated code in powerapp

Hi,

 

I have created small app based on sharepoint data.

 

App pull data from sharepoint and displayes summary using graphs and few labels. There are few actions on app screen like week filter and there is additional filter by some roles using drop downs. App also refreshes data using timer control every 5 min if app is kept running.

 

Code pulls data from 2-3 sharepoint views and manipulate data based on filters before it is displayed or everytime something changes in drop down screen values are refreshed.

 

Same code is used for Onvisible of screen, onselect in refresh icon, ontimerend in timer control and onchange in 2 drop downs.

 

Now there is duplication of codes. If i change anything i have to manually replicate code on all 5 locations on screen. Please suggest is there anyway i can simplify by writing 1 custom functions on powerapps which can be called on all 5 location. This can help me reduce errors and consistancy in reporting on screen.

 

Thanks and waiting for your reply.

 

Priyank

11 REPLIES 11

hey

Is it possible if I want to use 1 custom function in all 5 locations on your screen instead of the repeated code?

Thanks

Hi @Dipak ,

 

Easy way to do is

1. Add label to your powerapp screen and change visibility to false

2. write your script into OnSelect property of Label

3. You can call this script on other control(s) by calling 

Select(Label1)

Hope this helps.

 

Priyank Bhat

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (17,608)