Hi, there is a connector to Blob storage that return data like these:
[
{
"Id": "JTJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmY=",
"Name": "folder1/",
"DisplayName": "folder1/"
},
{
"Id": "JSJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmS=",
"Name": "folder2/",
"DisplayName": "folder2/"
}
]
and i'd like to validate if the result contains a element where Name == 'folder3/'
thanks
Solved! Go to Solution.
You can use an Apply to Each to iterate over the Array, use a Condition to verify if the Name field is 'folder3', and if it is, to set a variable to true in that event.
Where it says "Body" above for the Apply to Each, you place whatever is the correct Dynamic Content for your Flow whenever it outputs something similar to what you originally posted.
To test it with a hard coded content, you can do as follows:
For example, it also works, if we just use a Compose block like this, and just place something similar to what you posted in it, to simulate what is expected there:
and then just place the 'Outputs' of 'Compose 2' above, instead of where it says 'Body' in the above screenshot.
(notice there is a 3rd item added, it has a name folder3/ - that is intentional to test if it really works - it was also tested with and without the 3rd element, and found to work correctly in both cases).
The test run should give the following result in the 3rd iteration:
Notice that in this test, I did change your test input data to include a 3rd element with the name folder3/ to see if the Flow would recognize it, and it does indeed recognize it. Without the 3rd test element, it should leave the variable to false, to signal that no such element was found with a Name key containing a value of 'folder3/'
The test data used in this case,, was as follows:
[
{
"Id": "JTJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmY=",
"Name": "folder1/",
"DisplayName": "folder1/"
},
{
"Id": "JSJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmS=",
"Name": "folder2/",
"DisplayName": "folder2/"
},
{
"Id": "JSJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmQ=",
"Name": "folder3/",
"DisplayName": "folder3Dis/"
}
]
It was also tested without the 3rd element - in which case, it iterates only over the first two elements, and, not finding folder3/ in the Name, will intentionally fail to set the variable to true in that case, meaning it was working correctly.
Check if the above helps.
You can use an Apply to Each to iterate over the Array, use a Condition to verify if the Name field is 'folder3', and if it is, to set a variable to true in that event.
Where it says "Body" above for the Apply to Each, you place whatever is the correct Dynamic Content for your Flow whenever it outputs something similar to what you originally posted.
To test it with a hard coded content, you can do as follows:
For example, it also works, if we just use a Compose block like this, and just place something similar to what you posted in it, to simulate what is expected there:
and then just place the 'Outputs' of 'Compose 2' above, instead of where it says 'Body' in the above screenshot.
(notice there is a 3rd item added, it has a name folder3/ - that is intentional to test if it really works - it was also tested with and without the 3rd element, and found to work correctly in both cases).
The test run should give the following result in the 3rd iteration:
Notice that in this test, I did change your test input data to include a 3rd element with the name folder3/ to see if the Flow would recognize it, and it does indeed recognize it. Without the 3rd test element, it should leave the variable to false, to signal that no such element was found with a Name key containing a value of 'folder3/'
The test data used in this case,, was as follows:
[
{
"Id": "JTJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmY=",
"Name": "folder1/",
"DisplayName": "folder1/"
},
{
"Id": "JSJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmS=",
"Name": "folder2/",
"DisplayName": "folder2/"
},
{
"Id": "JSJmZG9jdW1lbnRsaWJyYXJ5JTJmQ2FydGErZGUrUmVudGElMmYyMDIxMDclMmQ=",
"Name": "folder3/",
"DisplayName": "folder3Dis/"
}
]
It was also tested without the 3rd element - in which case, it iterates only over the first two elements, and, not finding folder3/ in the Name, will intentionally fail to set the variable to true in that case, meaning it was working correctly.
Check if the above helps.
I think I have a better solution. Apply to each is painfully slow.
Here what I have done
1. get items form the SP list
2. create an html table (limiting to the column which contains the values I am going to search)
3, searching my string within the output of the HTML table creation (in my case condition was enough)
I did not count, but apparently it is 100 times faster than apply to each
Marco
Hi @PabloRoldan @marpio @poweractivate ,
Appreciate your efforts!!
I also have one solution which requires just 2 actions to determine, whether the item present in JSON or not.
1- Include FILTER action and provide JSON as input
item()?['Name'] is equal to folder3/
2- add a variable to check, whether the item is present or not.
Hi @marpio FYI this only works for up to 100 entries in order of ID of a list. Let me know if you have a workaround to pull a longer list of data into the HTML Table...
Thanks for this great solution.
User | Count |
---|---|
27 | |
14 | |
12 | |
10 | |
9 |
User | Count |
---|---|
51 | |
29 | |
28 | |
24 | |
21 |