10 Power Apps Code Examples To Improve Your Coding Style by Matthew
Image Source: Shutterstock.com
Jul 19, 2022 3:58 PM

10 Power Apps Code Examples To Improve Your Coding Style by Matthew

External Blog Post

As a programmer, I can constantly improve. It's nice when an expert gives insight into his years of experience how a good code can look like. Matthew gives 10 super good tips to improve your code

Matthew: “You, my fellow human, are about to become better at writing Power Apps code.

By following a coding standard you can make your apps easier to maintain and have less bugs. High-quality code is simple to read. It follows a consistent pattern. Your goal is to write code that is simple for other developers and your “future-self “to understand.”

  1. Use The WITH Function
  2. Apply Automatic Formatting
  3. Write Helpful Comments
  4. Flatten Nested IF Functions
  5. Have A Consistent Naming Convention For Controls & Variables
  6. Join Text Strings And Variables
  7. Choose Consistent Logical Operators
  8. Remove IF Statements When The Result Is A True Or False Value
  9. Simplify Logical Comparisons When Evaluating A Boolean
  10. Substitute The Self Operator For The Current Control Name

With function in Power Apps

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-with

Automatically format your formula!!

https://powerapps.microsoft.com/en-us/blog/automatically-format-your-formula/

Comment your PowerApps code!

https://powerapps.microsoft.com/en-us/blog/comment-your-powerapps-code/

Flatten Nested IF Functions

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-if

Power Apps Canvas App Coding Standards: Naming Conventions

https://www.matthewdevaney.com/power-apps-canvas-app-coding-standards-naming-conventions/

Join Text Strings And Variables

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-concatenate

$-Strings: A Better Way To Concatenate Text Strings In Power Apps

https://www.matthewdevaney.com/strings-a-better-way-to-concatenate-text-strings-in-power-apps/

Choose Consistent Logical Operators

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/operators

Operators and Identifiers in Power Apps

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/operators

Patch function in Power Apps

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-patch