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
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.

Top Solution Authors
Top Kudoed Authors
Users online (1,442)