cancel
Showing results for 
Search instead for 
Did you mean: 

Create custom functions / macros

Could we have the ability to create a custom fucntion for a PowerApp.

 

For example if I had the following function

 

CountRows(Filter(Request, CurrentStatus = "New Request", SiteTypeGallery.Selected.SiteTypeId = ParentSiteType.SiteTypeId))

If wanted to use it for different types of status, it would be good to be able to create a custom function / macro somewhere called StatusCount that takes two parameters status and sitetypeid. This would make it cleaner and also save have to go through each of the controls that use this to udate it if the condtion changes.

Status: Under Review
Comments
niga
Frequent Visitor

I just want to refer to DRY (Don't repeat yourself) principle.

mdevaney
Super User III

Power Apps now has custom functions as an experimental feature.  You can use them to store repetitive code and call the function as as many times as needed.  I created a custom function to calculate the 'last day of the month' for a given date.

Check out this link to find out how I made it:
https://matthewdevaney.com/power-apps-custom-functions-reusable-code/

 

powerapps-customfunctions-7-1-1024x643.jpg