cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CamCov
Helper II
Helper II

Seeking Logic advice for Document validation

Hello!

 

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

 

Background:

 

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!

4 REPLIES 4
v-liwei-msft
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.

vliweimsft_0-1652178222545.png

 

vliweimsft_1-1652178222546.png

 

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

 

vliweimsft_2-1652178222547.png

 

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

vliweimsft_3-1652178222548.png

 

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.
vliweimsft_4-1652178222549.png

 

vliweimsft_5-1652178222549.png

 

vliweimsft_6-1652178222550.png

 

 

5. Comparison length.

 

vliweimsft_7-1652178222551.png
 

Beat Regards,

Levi

Levi

Levi,

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. 

CamCov_0-1652275356360.png

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.

CamCov_2-1652275678355.png

 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,

Levi

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,818)