4

Context

I'm currently working on a specific search engine frontend, based on Powerapps, which need to pass a string array to a service through a Power-Automate Flow, in order to specify a filter.

The Flow

The flow itself takes a JSON object as input (which will be transmitted to the backend service), which looks something like this :

{
    service: "string"
    types : ["A", "B", "C", ...]
}

But Powerapps do not allow to create arrays, according to multiple source I found. When I try to serialize my object trough the JSON() function, I end up with the following result:

{
    service: "string"
    types : [{"Value" : "A"}, {"Value" : "B"}, {"Value" : "C"}, ...]
}

I've tried the following ways (and some more but I don't remember them all) to generate the object, hopping for something working, but I'm now out of idea.

Collect(arrayTypes; ["A", "B", "C", ...])
ClearCollect(arrayTypes; ["A", "B", "C", ...])
Set(arrayTypes; ["A", "B", "C", ...])
Set(arrayTypes; JSON(["A", "B", "C", ...]))
Set(arrayTypes; JSON(["A", "B", "C", ...].Value))
JSON(ForAll(arrayTypes.Value; ThisRecord.Value))

I'm currently considering passing the array as a comma separated string, and then insert it as a new value inside the JSON, but this will require to change the Power-Automate flow quite substantially (we actually got multiple array to pass), and I would prefer not to change this part too much.

Does anyone know a way to generate a proper JSON array from a Powerapps Collection/Table/Variable ?

Similar questions on StackOverflow that I've found
Nested tables in Powerapps - remove “Value” column when parsing JSON (No answer)
How to passing Text Input value from Gallery Control as a json in Power Apps? (Answer did not change anything to the current output)

Dremor
  • 789
  • 2
  • 8
  • 27

0 Answers0