Thank you for visiting my site!

Home / PowerApps - Forms / User Defined Functions for Powerapps

User Defined Functions for Powerapps

Format Currency for labels.

    1. Create a new Component
      create a component
    2. Add a  function “functionFiscalYear “to the Component crated
    3. set the function property type as output, set the data type that returns as string,
    4. Add a  new property to the function “paramDate”, data type: Date and Time, required hit Create
    5. Where to add the code, click on the function name and in the left properties box you can see the name of the function and the property that the function can use, stay on the function name line.
    6. Add Your code. [code] // fiscal year starts at October 1st 10/01/2021
      // 09/30/2021 is fiscal year 2021
      // 10/01/2021 is fiscal year 2022
      // so if month is => 10 then add 1 to the year.
      Month(paramDate) >= 10,
      Year(paramDate) + 1,
    7. How to use it:
      Got to a screen and add the new component created, minimize it. Add a date picker and a text input
    8. on the text input Default property call in the ComponentName.FunctionName(and pass the parammeter)

      Now you can use the same function in many places, but the code you can fix or change only once.
    9. Limitations: we cannot access data sources or objects from the host screen or app
    10. How to download and use existing UDFs
      Go to:
      Click on Date Functions

      Scroll down to “Minimal Path to Awesome”, click on the Download, save the .msapp on your computer,
    11. Create a new Canvas app
    12. Click on File
    13. Open
    14. Browse to the location where you downloaded the .msapp file, click on the file it will create a new canvas app, we to save it.
    15. Share it with the team: