cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
madmvx
Frequent Visitor

How to convert a Formated Array string to a collection to show in a Gallery

Hello!

Im getting from PowerAutomate to a PowerApps a response of an array like this:

 

 

[
  [
    "ReceiptTime:May 18 2021 12:51:23",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  ],
  [
    "ReceiptTime:May 18 2021 12:51:35",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  ],
  [
    "ReceiptTime:May 18 2021 12:51:59",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  ]
]

 

All of the strings are with this format "key:value"

Sometimes i will recieve more items or different KEY:VALUES  like this:

 

[
  [
    "Account:ABC\\ABC",
    "Computer:EQ-DC02.ABC.LOCAL",
    "IpAddress:99999",
    "AccountType:User",
    "Activity:4624 - An account was successfully logged on.",
    "LogonTypeName:10 - RemoteInteractive",
    "ProcessName:C:\\Windows\\System32\\svchost.exe",
    "StartTimeUtc:2021-05-18T14:59:13.063Z",
    "EndTimeUtc:2021-05-18T14:59:13.063Z",
    "ConnectinCount:2",
    "timestamp:2021-05-18T14:59:13.063Z",
    "AccountCustomEntity:ABC",
    "HostCustomEntity:EQ-DC02.ABC.LOCAL",
    "IPCustomEntity:10.10.52.149"
  ],
   [
    "Account:ABC\\ABC",
    "Computer:EQ-DC02.ABC.LOCAL",
    "IpAddress:99999",
    "AccountType:User",
    "Activity:4624 - An account was successfully logged on.",
    "LogonTypeName:10 - RemoteInteractive",
    "ProcessName:C:\\Windows\\System32\\svchost.exe",
    "StartTimeUtc:2021-05-18T14:59:13.063Z",
    "EndTimeUtc:2021-05-18T14:59:13.063Z",
    "ConnectinCount:2",
    "timestamp:2021-05-18T14:59:13.063Z",
    "AccountCustomEntity:ABC",
    "HostCustomEntity:EQ-DC02.ABC.LOCAL",
    "IPCustomEntity:10.10.52.149"
  ], [
    "Account:ABC\\ABC",
    "Computer:EQ-DC02.ABC.LOCAL",
    "IpAddress:99999",
    "AccountType:User",
    "Activity:4624 - An account was successfully logged on.",
    "LogonTypeName:10 - RemoteInteractive",
    "ProcessName:C:\\Windows\\System32\\svchost.exe",
    "StartTimeUtc:2021-05-18T14:59:13.063Z",
    "EndTimeUtc:2021-05-18T14:59:13.063Z",
    "ConnectinCount:2",
    "timestamp:2021-05-18T14:59:13.063Z",
    "AccountCustomEntity:ABC",
    "HostCustomEntity:EQ-DC02.ABC.LOCAL",
    "IPCustomEntity:10.10.52.149"
  ], [
    "Account:ABC\\ABC",
    "Computer:EQ-DC02.ABC.LOCAL",
    "IpAddress:99999",
    "AccountType:User",
    "Activity:4624 - An account was successfully logged on.",
    "LogonTypeName:10 - RemoteInteractive",
    "ProcessName:C:\\Windows\\System32\\svchost.exe",
    "StartTimeUtc:2021-05-18T14:59:13.063Z",
    "EndTimeUtc:2021-05-18T14:59:13.063Z",
    "ConnectinCount:2",
    "timestamp:2021-05-18T14:59:13.063Z",
    "AccountCustomEntity:ABC",
    "HostCustomEntity:EQ-DC02.ABC.LOCAL",
    "IPCustomEntity:10.10.52.149"
  ]
]

 

My Question is: is possible to convert this array of data to a Collection to show it in a gallery

Or convert it in a json to later parse and convert in a Collection?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @madmvx :

The schema of the two arrays you provide is the same, they are both: 

{
    "type": "array",
    "items": {
        "type": "array",
        "items": {
            "type": "string"
        }
    }
}

Best Regards,

Bof

View solution in original post

7 REPLIES 7
v-bofeng-msft
Community Support
Community Support

Hi @madmvx :

PowerApps cannot directly parse the array text, especially the data structure of your array changes dynamically.

I suggest you modify your flow and return your array to your canvas in array format (not in text format). Because flow can directly return the array to the canvas.

The specific action is "Response"
1.PNG

I think this link will help you a lot:

Return an Array from Flow to PowerApps (Response Method) 

Best Regards,

Bof

Hello @v-bofeng-msft, the problem is "response" needs a Json Schema 

And the data y dynamic so the schema will never gonna be the same, so what can I do to solve that? 

Hi @madmvx :

The schema of the two arrays you provide is the same, they are both: 

{
    "type": "array",
    "items": {
        "type": "array",
        "items": {
            "type": "string"
        }
    }
}

Best Regards,

Bof

View solution in original post

@v-bofeng-msft Thanks so much, im gonna test that, but first i need to change that array?

 

[
  {
    "ReceiptTime:May 18 2021 12:51:23",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  },
  {
    "ReceiptTime:May 18 2021 12:51:35",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  },
  {
    "ReceiptTime:May 18 2021 12:51:59",
    "Usuario:jbaca",
    "IPOrigen:10.10.52.145",
    "IPDestino:10.10.52.51",
    "AccountCustomEntity:10.10.52.51"
  }
]

To something like this? 

or i can pass the array normally? and the schema detect it?

 

and take in consideration the elements in my array are 

"key:value"

not

key:"value"

How can i change it?

@v-bofeng-msft 

Hi @madmvx :

I suggest you just try it first.

According to the json text you provided, the result will be 

"ReceiptTime:May 18 2021 12:51:23"

instead of 

ReceiptTime:"May 18 2021 12:51:23"

Best Regards,

Bof

madmvx
Frequent Visitor

@v-bofeng-msft  it works! thank you so much, but now im gettin like this the collection:

 

madmvx_0-1621392781851.png

How can i put this to a Gallery?

 

 

Hi @madmvx :

Create a Gallery(Gallery1) and set it's items property to:

CollectionOfEventsT

Create a sub Gallery(Gallery2) into Gallery1 and set it's items property to:

Thisitem.Value

Best Reagrds,

Bof

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,305)