Skip to main content

Performance, Refresh button, ForAll, and multiple field lookups

Earlier this week, we shipped release 2.0.531, which is bursting at the seams with fresh improvements and new functionality.  We’ll cover a few of the bigger items here, with the full list on the What’s New page.

Performance improvements

We’ve heard from you, often, that performance is a top concern.  We agree, and performance has been and will continue to be one of our top priorities. 

In this release, we have improved the performance of:

  • The various player apps load faster.
  • Your apps within the player will load much faster. 
  • Apps will load much faster in the studio for authoring.
  • And in many other areas too.

Refresh button

For apps that are created from data, we now include a Refresh button in the title bar of the browse screen:

image

With this button, users can refresh the data on this screen without needing to close and reopen the app.

ForAll and multiple record Patch

In our July user survey, you identified the lack of iteration as a limiting factor for using PowerApps.  To fill this gap we have added a new function: ForAll

ForAll( Table, Formula ) evaluates Formula across all of the records of Table.  The formula could perform a calculation or perform a series of actions, using the ; operator.   The function returns a table of the results from each formula evaluation, in the same order as the input table. 

Let’s look at a very simple example. Imagine you have a table of Values in a collection named Squares:

squares

We can call the Sqrt function for each of the records of this table with:

  • ForAll( Squares, Sqrt( Value ) )

Sqrt is called for each record of the table, and is passed the contents of the Value field.  This formula returns the table:

sqrt

Let’s take a slightly more complex example.  Imagine you have a collection named Sayings:

translate

We can call the Microsoft Translator service to translate each of these into Spanish with:

  • ForAll( Sayings, MicrosoftTranslator.Translate( Value, "es" ) )

which returns the table:

translate-es

You may ask why we named our new function ForAll instead of For or ForEach as many other languages do.   That’s because our system is designed for asynchronous and parallel operations.  The formula for one record may be paused waiting on a data operation, and while we wait, we may start evaluating the formula for another record.   The best way to think about it is that we could be evaluating the formula for all the records at the same time, with the implication that we can’t guarantee the order in which the formula for each record will be evaluated.  For most functions and services that are stateless and do not have side effects, including those used above, this is perfectly fine and allows us to optimize performance.  We are hoping that the All in the function name will differentiate it from other For constructs that imply an order.

That doesn’t mean you can’t use functions with side effects.  In fact, we believe a major use for ForAll may be moving data from one place to another, and you can use Collect, Update, and Patch within it.  For example, imagine a collection of Products, some of which need to be ordered:

prod

We’d like to create a new collection, with just the items that need to be reordered (for which Quantity Requested is greater than Quantity Available).  We can do this easily with ForAll:

  • Clear( NewOrder ); ForAll( Products, If( 'Quantity Requested' > 'Quantity Available', Collect( NewOrder, { Product: Product, 'Quantity To Order': 'Quantity Requested' - 'Quantity Available' } ) )

which results in the NewOrder collection being filled with:

prod-order

In PowerApps, there are many ways to accomplish the above task.  The documentation for ForAll gives more examples and a fuller explanation.

Finally, one of the reasons you gave us for needing iteration was the bulk update of data.  And ForAll can be used for that.  But as we think it may be common, we also added the ability to use the Patch function on a set of records instead of just modifying one record at a time.

Multiple fields in Lookups

With this release, we are introducing support for showing multiple fields from your lookup data source.

For example, let’s assume your data source contains a lookup field to your employee list, and in your company there are multiple people with the same first and last name.  So that users of your app can properly distinguish between “Anne Smith” from accounting and “Anne Smith” from engineering you can configure your lookup to show more than one field.

To do so, when working with a Edit form control,  expand the menu from the right side pane and change display fields from 1 to 2:

3

Next, change Value2 to Department, Job title, or another field and see how these choices are reflected in the dropdown:

image

Multiple field support is available for both SharePoint and Microsoft Common Data Model today with more connector support on the way.

And so much more…

Check out the What’s New page for more details on:

  • Available in several new languages with more on the way.
  • Select and rename controls more easily.
  • Find options in the toolbar more easily.
  • Show the Advanced view with a single click.
  • Better sorting and filtering across sessions and devices.
  • Improved feedback mechanism where you can track the progress of a ticket.
  • Raise numbers to new heights with the Power function.