Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Verify a value, if it exist in an Array

(0) ShareShare
ReportReport
Posted on by 2
Hi,
 
I have struggles with a function, which should check, if a value is already inside an array or not, and if it's not there, it should be added.
 
I have an array, with several columns (they are filled at the beginning of the flow from an sharepoint list).
I have as well an second array, which is empty.
 
I have a value "project-id", which could be several times inside the array (It's a list, where people can loan some stuff).
So, I guess, I can take the array, and check, if the value "project-id" is already inside the "filtered array" or not. If it's already inside, it should be done nothing, otherwise it should be added to the array. (The first item is added by default, because the second array is empty at the beginning).
 
I tried it with the function "Filtered Array", with several composed arrays, with the contains function etc. and nothing works as I need it.
 
I'm little bit lost now, how I could get a filtered list, where each Project is just one time inside the array.
 
My goal is, to create a reminder to the persons, who loan some stuff and bring them back on time.
 
The problem is as well, that I couldn't really recognize at the Flow-History, which value was compared with with value, if there is a format issue or there was taken a wrong value, etc.
At the Compare function for the Input area is just noted: 
 
{
"expressionResult": false
}
 
I checked some blog-article as well and tried it with this solutions, but without any success.
 
Does anybody have a really good solution or any hint, how I can solve this issue?
 
The best goal could be, that I can send an reminder to the person, who loan some stuff and get a short list, what they have loan and until when they should have to bring it back, etc,
All these data are insode the array.
The easiest way will be, to send for each article an own mail, but this could be annoying to the recipients...
 
Thanks and best regards,
Florian
  • Suggested answer
    Pstork1 Profile Picture
    Pstork1 64,909 on at
    Verify a value, if it exist in an Array
    If you do a Filter Array action on the array where Project-ID is equal to the value you are looking for you can then check the length() of the output. If the length is greater than 0 then the array already contains the Project-ID. If its 0 then it doesn't.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard