Here’s an exciting update users are starting to see in Oct 2022. Is to Format Input data based on examples i.e. generating Expressions instead of writing them yourselves in Power Automate!
At the time of this post, this is in Preview and hence, please consider that this might or might not make it to final release and hence, not recommended for Production use!
Let’s see how this works!
Expressions using Data Samples in Power Automate
Here’s how you can generate Expressions that have been generated from Examples you provide –
- In Dynamic Content, go to Expressions, you’ll see the Format data by examples option at the top.
- I’m passing Date in the Flow as below –
- This will open up a pane on the right hand side to select the data variable for which the expression has to be generated.
I want to format a Date from the Inputs in a certain way. Hence, I’ll select Date from the Pane which has opened up.
- Upon selection, I’ll provide some examples on what values can come in and what should it be translated to.
- Here, I’ll enter some examples on how the input date can be expected to which what the output format should be desired.
Once I provide a few examples, I can click on Get expression for the Flow to generate a custom expression for me based on the examples I provided.
- Upon clicking Get expression, the Flow will generate a custom Expression for you which you can test/copy right away.
- Note that in the above, the key-button-date is set, you need to set this to the actual field
- Here’s an example which I’m testing –
And it produced the correct result –
- So, I’ll click on Apply.
- You’ll be asked confirmation before Applying this formatting –
- Once you confirm, the Expression will be generated.
- And when you test the actual Flow, it’ll expect the value based on how you tested the Expression and produce the result –
In this case, the key-button-date i.e. the current Date was formatted. Hence, the current date will be returned.
- And the answer is as below –
Hope this was useful!!
Currently, below are the types of formats supported –
Here’s a Text based example you can think of –
- In a Text based Example, I want only first 3 letters of a City.
- Here’s the expression Generated which I can check –
- And like the main example above, this expression can be applied!
Here’s a quick number example you can think of –
- Let’s say you want to format a number in a phone format or currency –
- And the expression will be generated for the same –
Here’s Microsoft Documentation on the same – https://learn.microsoft.com/en-gb/power-automate/format-data-by-examples?WT.mc_id=DX-MVP-5003911
Hope this was useful!
Here are some Power Automate posts you want to check out –
- Select the item based on a key value using Filter Array in Power Automate
- Select values from an array using Select action in a Power Automate Flow
- Blocking Attachment Extensions in Dynamics 365 CRM
- Upgrade Dataverse for Teams Environment to Dataverse Environment
- Showing Sandbox or Non Production Apps in Power App mobile app
- Create a Power Apps Per User Plan Trial | Dataverse environment
- Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
- Co-presence in Power Automate | Multiple users working on a Flow
- Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
- Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
- Call a Flow from Canvas Power App and get back response | Power Platform\
- FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
- Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
- Asynchronous HTTP Response from a Flow | Power Automate
- Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
- Converting JSON to XML and XML to JSON in a Flow | Power Automate