POWER APPS – FISSION DEV – Part 3

This image has an empty alt attribute; its file name is Fission-Dev.png

Level: Orange (on scale of white, yellow, orange, …, black)

Very Basic Themes

Last time we discussed “Nucleus: First Field on Screen“, this time we extend the concept by introducing themes.
Microsoft have introduced a great theming method. However, I feel this may be a little cumbersome for the newbie.
This method suggested below is vey basic and also introduces some basic Power App concepts. In the longer term, I hope to return to the themes (per Microsoft).

Before we discuss themes the critical concept of variables and collections need to be discussed. I am not going to explain this concept (many blogs and articles have addressed this)

Variables and Collections

Variables are critical to Power Apps. They are very powerful and source of errors. So it is important to be very meticulous. Power Apps has the concept of local and global variables. Unfortunately this does not extend to collections. All collections are global in nature. This global nature in turn becomes a source of many errors.

Variables:

Global : Uses the ‘Set’ syntax, for example

Set (g_versionNo , “V1.0.0.0”)

Where g_versionNo is the global variable

Local: Uses the ‘UpdateContext’ syntax, for example

UpdateContext({ l_count_mnu: 1})

where l_count_mnu is the local variable

Collections

Collect (g_colPeople, Filter(tblPeople , lastname = “Bloggs”))

where g_colPeople is the collection

There is no alternative syntax for local collections.

Naming Collections Conventions

To overcome this shortcoming, my suggestions is to name collections to identify the scope.
For example prefix

g_col – is used to identify collection as global collection
l_colPerson_mnu – is used to identify the collection as local. The suffix “_mnu” identifies the screen that the collection, relates to. in this scenario the menu screen.

I also go one step further: if a collection is usedin a single event (function) then my naming convention is
t_colPeople_mnu where t_ identifies the collection as limited to a function.

Naming Collections Variables

Similar to above I use same prefix and suffix to label variables:

g_versionNo is a global variable
l_calcRate_inv is a local variable used in the ‘invoice screen”
t_id_inv is a temporary variable used in a single function on the “invoice” screen

Basic Themes
This will be deferred until next time as this blog is already long.

To finish off my pet hate regarding variables is two fold:

1) watching YouTube videos where ‘Set’ is used and should be ‘UpdateContext’
2) watching YouTube videos where variable name have no meaning