Until now, the defined values used in the app have been defined as global variables in the “App.OnStart” property, but now that the new “App.Formulas” property has been added, I tried it out.
Previously, the definition values were declared using the Set function in the App.OnStart property
Of course, there was nothing wrong with the functionality, but there were problems as shown below.
- It’s set at app startup, so depending on the value, startup time will be slower.
- Expression in App.OnStart property increases and is difficult to read
- The declared definition value can be rewritten
The new functionality added to this is the “App.Formulas” property, which allows you to declare defined values to be used in the app.
App.Formulas
Advantages of App.Formulas
According to the formula, compared to global variables, values declared in App.Formulas have these advantages
- Formula values are always available
- Formula values are always up-to-date
- The definition of the formula is invariant.
- Can delay the computation of formulas
- Formulas are managed by a name manager and automatically recalculated
Formula values are always available
Values declared in App.Formulas can be used without considering timing as long as they do not create circular references.
Formula values are always up-to-date
Formulas to define values obtained from the data source, these defined values will be automatically updated when the data source is updated (no need to reassign them like a Set).
This may be useful, for example, when storing per-user settings for apps in Dataverse or SPO lists.
The definition of the formula is invariant.
This will prevent accidental rewriting of the definition values.
Can delay the computation of formulas
Values declared in App.Formulas are calculated at the time they are needed, which also reduces startup time.
For example, if a defined value that is not used on the top screen is declared in App.OnStart, that defined value will be calculated/set when the app starts.
In contrast, declaring a defined value in App.Formulas reduces OnStart’s load considerably because the declared value is calculated/set when it is needed.
Formulas are managed by a name manager and automatically recalculated
I didn’t understand this last one, but for the moment, the original text.
(I can’t think of any at the moment.) This could be a use for this somewhere else.
So the newly added App.Formulas property is quite useful and should be used actively.
コメント