cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vstar19
Helper V
Helper V

Format Email

Hello All. 

 

I have a email, whose output looks like this 

 

[{"Item Name":"Item A ","Item ID":"9F6FE723","Date":"2021-09-03"},{"Workspace Name":"ItemB","Item ID":"B174AB0B","Date":"2021-08-27"}]

 

i need to format this, preferably into a table in the email

 

1. Item : Item A

   Item ID : 9F6FE723

   Date : 2021-09-03

 

2. Item : Item B

   Item ID : B174AB0B

   Date : 2021-08-27

 

There may be several more items, i am just using 2 as an example.  

 

I tried to use the slit function, so whenever there is }, split the line into the next row - but for some reason, this add some funny characters to the text. 

 

Can someone assist me please? Having the numbering would be beneficial. 

 

Thanks

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Community Champion
Community Champion

You could use a Select and Create Table action:

ekarim2020_3-1630941593284.png

Expression for Item:

if(empty(item()?['Item Name']), item()?['Workspace Name'], item()?['Item Name'])

Expression for ItemID:

item()['Item ID']

Expression for Date:

item()?['Date']

ekarim2020_2-1630940930174.png

ekarim2020_0-1630942205012.png

The expression only works if there is a property called 'Item Name' or  'Workspace Name'.  If neither exists, item will be set as null:

ekarim2020_4-1630941942889.png

However if there are going to be a lot of variations for the item property name, you may find it easier to replace all of the variations of the text (using the replace function) to a single property name (eg. Replace all 'Workspace Name' to 'Item', replace 'Workspace Name variation text' to 'Item' and so on) . You wont need to use the Select operation.

Ellis

View solution in original post

2 REPLIES 2
ekarim2020
Community Champion
Community Champion

You could use a Select and Create Table action:

ekarim2020_3-1630941593284.png

Expression for Item:

if(empty(item()?['Item Name']), item()?['Workspace Name'], item()?['Item Name'])

Expression for ItemID:

item()['Item ID']

Expression for Date:

item()?['Date']

ekarim2020_2-1630940930174.png

ekarim2020_0-1630942205012.png

The expression only works if there is a property called 'Item Name' or  'Workspace Name'.  If neither exists, item will be set as null:

ekarim2020_4-1630941942889.png

However if there are going to be a lot of variations for the item property name, you may find it easier to replace all of the variations of the text (using the replace function) to a single property name (eg. Replace all 'Workspace Name' to 'Item', replace 'Workspace Name variation text' to 'Item' and so on) . You wont need to use the Select operation.

Ellis

View solution in original post

Vstar19
Helper V
Helper V

Again, Thank you very much Ellis. You have been my saviour this week. 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,891)