PowerApps Coding for the image screen

16-04-2019  0 Comment(s)

There’s two ways you can approach this.

The first way is to group controls then assign click events to the group’s OnSelect event.

The second way is to lay a transparent rectangle on top of the group and use the rectangles OnSelect event.

I prefer the second way because it doesn’t impact my code as much if the controls in the group change and it also allows me to have more flexibility of the shape of the region I want to make clickable.  See this article I wrote for more information about the transparent rectangle approach.

General coding guidelines

If possible, avoid logic in the OnVisible event in your PowerApp’s first screen.  Instead, try to use inline expressions in control properties.

Limit your use of collections, try to use them only when absolutely necessary.

Limit your use of context variables, try to use them only when absolutely necessary.

Avoid passing context variables between screens when a global variable is more appropriate (and much easier to debug)!

Use ClearCollect instead of Clear;Collect().

Use CountIf instead of Count(Filter()).

Avoid lengthy expressions whenever possible!

Each semi-colon should represent a line break.

Update all necessary context variables in a single UpdateContext call

Like this:

Not this:

Use proper indentation

For long single line formulas, try to insert line breaks in reasonable places: before/after parentheses, commas, and colons.

Update:  Avoid using unnecessary DataCards \ Canvases.  Especially if they have nested galleries, which will not work in the future.


Don’t use multiple variables when you could just use a single one.

We could just use 1 variable here instead.


Avoid nesting in other operators too.  For example in the ForAll function.

If statement syntax

Don’t ‘nest’ secondary logical tests by explicitly writing If after the initial statement.

Do write secondary logical tests by simply writing out the logical test (w/o the ‘If’).

Update: Expensive calls

Do not make expensive calls before navigating to the next page.  Try to make the loading of the next page instant and then in the background on the next page make the calls in the OnVisible page property.  Use a loading dialog if necessary to let the user know progress is happening behind the scenes.

Comment Here


No Comments to Show