cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Map datatable or in general a variable in power automate desktop

Hi all,

 

is there a possibility to have this selector (image below) in power automate desktop. I would need the possibility to read a data table, and, for example, add a custom column based on another column value... so mapping an array to a custom one.

 

I want to avoid looping the datatable with the loop connectors in power automate desktop since they are really really slow.

 

Thanks!!

Capture.PNG

4 REPLIES 4
sakula1996
Responsive Resident
Responsive Resident

Hi @Anonymous ,

 

Yes, it's possible. Please follow the screenshots below:

 

Observe third action. --> Use Set Variable action and change NewVar to JsonAsCustomObject.name

 

Copy and paste this code in PAD development canvas to get the below actions. It will automatically convert the below code to GUI elements.

 

SET NewVar TO $'''{\"name\":\"sachin\"}'''
Variables.ConvertJsonToCustomObject Json: NewVar CustomObject=> JsonAsCustomObject
SET JsonAsCustomObject.name TO $'''Hello'''
SET NewVar2 TO JsonAsCustomObject.name

 

 

Hope this helps 🙂

 

 

sakula1996_0-1616010755910.png

 

sakula1996_1-1616010774623.png

 

sakula1996_2-1616010792601.png

 

sakula1996_3-1616010813826.png

sakula1996_5-1616010876442.png

 

sakula1996_4-1616010828548.png

 

 

 

 

burque505
Helper V
Helper V

@sakula1996, that is just as slick as it can be! 👍👍👍

I had no idea you could drop code into the PAD development canvas. Just tried it, works great.

Regards,

burque505

sakula1996
Responsive Resident
Responsive Resident

@burque505  awesome 🙂

Anonymous
Not applicable

Hi @sakula1996 , thanks but how I can apply this solution with a JSON with multiple childs?

 

For example I have this JSON:

{
"1": {
  "ID": "SGML",
   "SortAs": "SGML",
   "GlossTerm": "Standard Generalized Markup Language",
    "Acronym": "SGML",
    "Abbrev": "ISO 8879:1986"
},
"2": {
  "ID": "SGML",
   "SortAs": "SGML",
   "GlossTerm": "Standard Generalized Markup Language",
    "Acronym": "SGML",
    "Abbrev": "ISO 8879:1986"
}
"3": {
  "ID": "SGML",
   "SortAs": "SGML",
   "GlossTerm": "Standard Generalized Markup Language",
    "Acronym": "SGML",
    "Abbrev": "ISO 8879:1986"
}
}

and I want, for each child "1", "2", "3", create another item based on the concatenation of "ID" and "Abbrev". With the "select" connector in the service, I can do something like this:

json(
    concat(
        '["',
        item()?['ID'],
        '","',
        item()?['Abbrev'],
        '","',
        concat(item()?['ID'],item()?['Abbrev'])+'"',
        ']'
    )
)

So create an array with square brakets, and insert a custom item (in this case is the concatenation of two other items). 

Thanks

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,417)