添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I have a SharePoint Note column that holds a JSON string. The string contains survey responses submitted by a Power App.

I want to access values from the JSON string in Flow by giving a key e.g. 'Add value of question number 1 to a variable'

I have achieved this using a single value as a test but it's quite slow and I expect by the time I've added multiple variables.

First I parsed the JSON.

Then I used Filter Array to get the client email address and set a variable to the response.

"questionNumber": 4, "questionText": "Client Email Address", "response": "[email protected]" "fieldType": "Short Text", "otherAnswer": "", "questionNumber": 6, "questionText": "Client First Name", "response": "Dean"

Is there a simpler way to do this other than having multiple filter array actions?

Hi @amanna2 ,

The first item doesn't have a ABC property, so the error is correct. In this example the expression would be referencing the second item

body('Select')[1]['ABC']

If you don't know in which item the ABC property is, you can use an apply to each for this as well and reference the ABC property with the item function:

item()?['ABC']

You can also use a Filter Array as well to find the matching item.

Btw, do you mind creating a separate thread for this. It is easier to help you out over there.

Hello @Expiscornovus ,

I tried that. but first() or index is referencing to the first array element. So, i am not able to get the values using the keys.

InvalidTemplate . Unable to process template language expressions in action 'Compose_2' inputs at line '0' and column '0': 'The template language expression 'first(body('Select'))['ABC']' cannot be evaluated because property 'ABC' doesn't exist, available properties are 'XYZ'. Please see https://aka.ms/logicexpressions for usage details.'.
Here XYZ is the first key of the first element.
[
{
"XYZ" : "492"
},
{
"ABC" : "477"
}
]
i want to know the value of ABC. the array is not fixed. the key values are dynamic. so i need to fetch the data using the key.

Hi @amanna2 ,

The Select returns an array. So, you could use an apply to each loop to loop through it and use the columns and values.

Alternatively, you can use an expression to retrieve a specific item of the array.

The first item would be:

first(body('Select'))

The company name of the first item would be

first(body('Select'))['Company Name']

You can also use an index for referencing items. The index always start counting with 0 (first item). So that would be 1 (second item), 2 (third item), 3 (fourth item), etc.

The company name of the third item would be:

body('Select')[2]['Company Name']

Hi @Digital ,

Instead of the parse json, filter array actions I would try a Select action instead.

With the key/value mapping you could change a lot. For example you could use the questionText value as a key name.

Below is an example approach.

item()?['questionText']

Value

item()?['response']

Subscribe to

Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.