cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AVTS
Super User
Super User

ForAll Ignore Duplication

Experts,

 

Trying to exclude the records in forall formula if that(HTTP_Body) is more than once is existing in collection pmosave2 . 

 

 

ForAll( pmosave2,
Postpmo1.Run(
HTTP_Body,
HTTP_Body_1,
HTTP_Body_2,
HTTP_Body_3,
HTTP_Body_4,
HTTP_Body_5,
HTTP_Body_6
)
);

 

How to achieve this. Please advise. 

1 ACCEPTED SOLUTION

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi @AVTS ,

Ok, we might be getting closer, even if it's by trial and error 😊

let's try break the logic down in your statement;

"if any  number  in HTTP_Body is exceeds more than one time"

 

If(
   CountRows(
             Filter(pmosave2, HTTP_Body=678)
            )=1, 
   

 

"then that should not be send to flow."

 

If(CountRows(Filter(pmosave2, HTTP_Body=678))=1, 
    //if count = 1 then run flow for HTTP_BODY=678,
   //if count is not = 1 (0 or more than 1) then don't run flow for HTTP_BODY=678
)

 

So - if there is more than one row with HTTP_Body=678 in pmosave2, then don't run the flow for HTTP_Body=678

Presumably then, we're back to using a ForAll() so we can evaluate this logic for each row in pmosave2, instead of one by one for a value like "678"... So place the following code onto a button OnSelect: property, just so we can test;

 

ForAll(pmosave2 as currentRecord,
  With({rowCount: CountRows(Filter(pmosave2, HTTP_Body=currentRecord.HTTP_Body))},
  If(rowCount = 1,
   Postpmo1.Run(
    currentRecord.HTTP_Body,
    currentRecord.HTTP_Body_1,
    currentRecord.HTTP_Body_2,
    currentRecord.HTTP_Body_3,
    currentRecord.HTTP_Body_4,
    currentRecord.HTTP_Body_5,
    currentRecord.HTTP_Body_6
    )
  )
 )
);

 

This will now evaluate each row of pmosave2, and if the HTTP_Body value appears only once in the source, then it will run the flow for that row - otherwise if it appears more than once, it will not run the flow

Hopefully we're getting a little closer to what you want - let me know how it goes!

Kind regards,

RT

 

View solution in original post

7 REPLIES 7
RusselThomas
Microsoft
Microsoft

Hi @AVTS ,

I'm not sure, but I think what you're trying to say is you want the ForAll() flow to run only once per distinct HTTP_Body value?

 

If so, then something like this;

ForAll(Distinct(pmosave2, HTTP_Body),
  With({currentRecord: LookUp(pmosave2, HTTP_Body=Result)},
   Postpmo1.Run(
    currentRecord.HTTP_Body,
    currentRecord.HTTP_Body_1,
    currentRecord.HTTP_Body_2,
    currentRecord.HTTP_Body_3,
    currentRecord.HTTP_Body_4,
    currentRecord.HTTP_Body_5,
    currentRecord.HTTP_Body_6
   )
 )
);

Hope this helps - if I misunderstood, please try and rephrase or provide more detail/examples

Kind regards,

RT

Dear Russel,

 

Thanks for responding . 

 

Actually it should pickup only green highlighted value (678) and  rest of the rows should not be part of this since its getting repeated. Forall should exclude this kind of rows.  

Below is the screenshot from pmosave2 collections. 

 

AVTS_0-1658228439231.png

 

After running forall Postpmo1.Run should send only the below records

 

678.

 

How to achieve this.

 

Thanks in Advance. 

RusselThomas
Microsoft
Microsoft

Hi @AVTS ;

Assuming 678 is a number and not a text value, try the following;

With({currentRecord: LookUp(pmosave2, HTTP_Body=678)},
Postpmo1.Run(
    currentRecord.HTTP_Body,
    currentRecord.HTTP_Body_1,
    currentRecord.HTTP_Body_2,
    currentRecord.HTTP_Body_3,
    currentRecord.HTTP_Body_4,
    currentRecord.HTTP_Body_5,
    currentRecord.HTTP_Body_6
   )
)

Kind regards,

RT

Thank you i have tried with your advise, Below code is applied,

 

With({currentRecord: LookUp(pmosave2, HTTP_Body=100016260)},
Postpmo1.Run(
currentRecord.HTTP_Body,
currentRecord.HTTP_Body_1,
currentRecord.HTTP_Body_2,
currentRecord.HTTP_Body_3,
currentRecord.HTTP_Body_4,
currentRecord.HTTP_Body_5,
currentRecord.HTTP_Body_6
)
);

 

Total 10 records in the collections(pmosave2) with duplicated entries. 

 

From flow context there are three records are executed . one is 100016260 and second is 300003760 and third one is 000000000000

 

 

 

AVTS_1-1658231112496.png

AVTS_2-1658231130478.png

AVTS_3-1658231161517.png

 

 

 

 

But the requirement is that if any  number  in HTTP_Body is exceeds more than one time then that should not be send to flow. In above case no data will be  send to flow since all number is having duplicated entries.

 

How to achieve this. Thanks in Advance. 

RusselThomas
Microsoft
Microsoft

Hi @AVTS ,

Ok, we might be getting closer, even if it's by trial and error 😊

let's try break the logic down in your statement;

"if any  number  in HTTP_Body is exceeds more than one time"

 

If(
   CountRows(
             Filter(pmosave2, HTTP_Body=678)
            )=1, 
   

 

"then that should not be send to flow."

 

If(CountRows(Filter(pmosave2, HTTP_Body=678))=1, 
    //if count = 1 then run flow for HTTP_BODY=678,
   //if count is not = 1 (0 or more than 1) then don't run flow for HTTP_BODY=678
)

 

So - if there is more than one row with HTTP_Body=678 in pmosave2, then don't run the flow for HTTP_Body=678

Presumably then, we're back to using a ForAll() so we can evaluate this logic for each row in pmosave2, instead of one by one for a value like "678"... So place the following code onto a button OnSelect: property, just so we can test;

 

ForAll(pmosave2 as currentRecord,
  With({rowCount: CountRows(Filter(pmosave2, HTTP_Body=currentRecord.HTTP_Body))},
  If(rowCount = 1,
   Postpmo1.Run(
    currentRecord.HTTP_Body,
    currentRecord.HTTP_Body_1,
    currentRecord.HTTP_Body_2,
    currentRecord.HTTP_Body_3,
    currentRecord.HTTP_Body_4,
    currentRecord.HTTP_Body_5,
    currentRecord.HTTP_Body_6
    )
  )
 )
);

 

This will now evaluate each row of pmosave2, and if the HTTP_Body value appears only once in the source, then it will run the flow for that row - otherwise if it appears more than once, it will not run the flow

Hopefully we're getting a little closer to what you want - let me know how it goes!

Kind regards,

RT

 

thank you Russel,

 

sure let me try . 

Thank you very much .... 🎉

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Community Call Conversations

Introducing the Community Calls Conversations

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

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,932)