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
Microsoft
Microsoft

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,698)