PNF1

Microsoft has released many new features and enhancements for PowerApps since June 2018, part of this blog we will cover three new functions introduced which I believe would be mostly used.

GUID Function:

In my blog, I mentioned how to generate unique GUID using Azure function which requires us to create an azure function, a custom connector and connection between two. Microsoft has now introduced a new function GUID() which will generate unique GUID every time it is invoked or convert passed string into GUID.

Syntax:

  • GUID() – will return unique value of GUID type
  • GUID(strGUID) – here strGUID is string value which should be 36 hexadecimal digits with or without hyphens.

For more details, please refer here.

Demo:

  • Add a button and label on form. Set OnSelect property of button with below which will generate unique GUID value using GUID() function, converts it to string and finally assign it to uniqueGUID variable.

Set(uniqueGUID, Text(GUID()))

PNF2

  • Set Text property of label to uniqueGUID
  • Run your app and click this button or ALT + Click this button in design mode only
  • Every time button is clicked, new GUID value is assigned to label

PNF3

Concurrent Function:

Microsoft mainly focused on quality, performance in last few releases. One of major improvement in performance is achieved by enabling users to execute multiple operations concurrently instead of sequentially using Concurrent function. In scenarios where we need to load multiple collections or to render data in multiple controls when app starts, this function is very useful.

Syntax:

  • Concurrent(Formula1, Formula2, —, Formulan) – All formula’s will be evaluated and invoked simultaneously when used within concurrent function.

For more details please refer here.

Demo:

  • I have 2 buttons added on form. One button (button1) loads data into collections without using Concurrent function and other button (button2) using Concurrent function.
  • OnSelect property of button1 is set to below:
ClearCollect(table1, Accounts);
ClearCollect(table2, Contacts);
ClearCollect(table3, Activities);
ClearCollect(table4, LookUp(Accounts,statecode=0));
ClearCollect(table5, LookUp(Contacts,statecode=0));
ClearCollect(table6, LookUp(Activities,statecode=0)
  • OnSelect property of button2 is set to below:
Concurrent(
ClearCollect(table11,Accounts),
ClearCollect(table21, Contacts),
ClearCollect(table31, Activities),
ClearCollect(table41,LookUp(Accounts,statecode=0)),
ClearCollect(table51, LookUp(Contacts,statecode=0)),
ClearCollect(table61, LookUp(Activities,statecode=0))
       )
  • As shown below, button1 execution time is 2-3 times more than button2 execution time which uses Concurrent function.

PNF4

Notify Function:

Microsoft has repurposed ShowError function which was used to display error messages only to now display all types of messages by renaming it to Notify function. Notify function can be used to display success, error, warning, information type messages based on Notification type passed as parameter.

Important Note: Notify function can be used with behavior formulas only which means you can use it with properties which change app behavior by triggering series of actions. For example: You can use Notify on OnSelect of button or on OnChange of dropdown but not in Text property of label.

Syntax:

  • Notify(strMessage, NotificationType)
    • strMessage – message to be displayed in notification
    • NotificationType – Success, Error, Information, Warning. This is optional. If not value is passed, default is Information type.

For more details please refer here.

Demo:

  • Add button on a form and set OnSelect property to below

Notify(“This is test message”, Success)

  • Click on this button, notification banner will appear with message and appropriate color, icon based on notification type passed.
  • Shown below are how different error messages look like for each notification type.

PNF5