Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Seeking Logic advice for Document validation



I am tasked with creating a custom document handling process in the power platform. 




I have two document libraries, one is a "list" of documents required at each stage of a project(Lib A), the other is the document library holding the actual submitted documents(Lib B).


I need help turning this pseudo code into a PA Flow:


x = Length(get all items in Lib A where stage = current stage)

y = Length(get all items in Lib B where stage = current stage && document name = a document name in Lib A)

if y = x, move to next stage


Basically, I want a way to ignore all of the documents in Lib B that are not required IE do not have a matching Name/title in Lib A 


In Lib B they can store any amount of documents, but I only want to count the required ones for the project. Right now my flow just counts everything in both. 


Any help/advice is greatly appreciated!

Community Support
Community Support

Hi @CamCov ,


Could you please tell me what the data type of stage is?

I assume that the data type of stage is text.

If you want to filter that the document names in B are the same as those in A, you cannot directly compare the two objects, so you need to use join to convert A into string type and then match the document names in B.

I have made a test for your reference:

1.Set up LibA and LibB.





2.Obtain LibA files and filter the files in which the stage is current stage. Use compose to output the length.




3.Get the LibB files and filter the files in which the stage is current stage.



4.You can't directly take out the object and compare whether the name is the same. 
You can use join to convert A to string type to filter documents with the same name as A in B.
Use compose to output the filtered B library length.







5. Comparison length.



Beat Regards,




Thank you for the quick response!! Just to make sure we are on the same page:


Below you will see that the two required documents are PSF01 and PSF09. PSF01 has been submitted in lib b and PSF09 has not. Everything else submitted in Lib B is considered extra documentation at this point. So this would fail the condition check and not let you move to the next stage. 


I want to ensure All documents in Lib A have a match in Lib B. 


Your answer may be correct, but this picture threw me off as it looks as it checks all the contents of Lib A against only 1 item.


 I could be incorrect here, but just want to make sure.




I see now a grave mistake I have made. My Project stage is a multiselect choice column because some documents are required at multiple stages

Hi @CamCov  ,


Item is the function that when used inside a repeating action over an array, return the current item in the array during the action's current iteration. You can also get the values from that item's properties.

Beat Regards,



Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,921)