Microsoft is continually building AI functionality to improve the coding and non-coder experience with examples that include natural language query code generation. In this post, we will explore the pre-release Power Apps Ideas functionality, which transforms natural language formula to code, and the Train with Examples functionality that takes advantage of the ideas of Programming by example (PBE). We will look at how it is applied in the Canvas Apps in data table and gallery controls, where we can transform natural language to Power Fx code. This can be particularly useful when learning Power Fx and Power Apps. We will also take a look at how we can train Power Apps to handle some scenarios.
First, let’s create a new Canvas app:
Let’s call it Simple App:
Let’s connect to data:
We will add Accounts from the Dataverse:
And on Screen1 we will add a Data Table:
The data table presents us with a list of Ideas on the right, such as show the top 10 accounts, accounts modified in the last 7 days, etc:
I will select Sort Accounts by Account, and we can see the expression is automatically as a Power Fx formula created to sort by accounts ascending:
We can manually enter our own Idea, for example sort by ‘Account Name’ to override the formula to sort by the Account Name field, and the formula is generated:
Now let’s add a new screen, with a Text Input:
And a vertical gallery:
Now we can type in our idea into the Gallery control. The Ideas functionality supports tying a text box to our gallery results, with the data sorted as we specify:
Our code is generated:
And running this Power App, we can type into the text box and it displays the results:
Some other examples and limitations are listed here.
Let’s look at the Train with Example functionality. Train with Example is built on PROSE technology, or Programming by Examples and Natural Language built at Microsoft Research. PROSE is in use in various Microsoft products, including Excel, Power BI, SSMS etc. Let’s look at how it works in Power Apps.
If we select a field such as the phone number field, we see the Train with Examples option:
Notice how the phone numbers in my Dataverse table are saved as XXX-XXX-XXXX. If we want to change it to (XXX) XXX-XXXX, we can enter examples of this new desired format, and the system will figure out how to transform this display to users:
When we click on Get Ideas, we are presented with a new formula (note, it is much easier to have this generated for us):
Our formula is now applied to our data table field and presented to the app users:
You can see this type of functionality can save time building code from scratch. See here for some limitations.
Hopefully you find it useful.
I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.
IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.
THANK YOU, AND LET'S KEEP LEARNING TOGETHER.
CARL