cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnthonyJrJr
Frequent Visitor

Multiple different IF criteria to be executed

Hi guys,

 

I have checked everything and everywhere but I'm still struggling with this.

I'm trying to execute two different IF's and I want both of them to be checked and to be executed if true or false.

 

On button click I'm patching my collection and based on that patch I want to check 2 different criteria, in pseudocode it would look like this:

1. Patch Value (patch #1) - works (on button 1 click)

2. Create new Collection after patching - works

3. Use new patched Collection to check "IF criteria #1" with multiple conditions - if true execute patch #2

4. Use new patched Collection to check "IF criteria #2" No matter what was the result of "IF criteria #1"  - if true execute patch #3

 

Independently steps 3 and 4 are working on two separate buttons for each "IF criteria" (IF 1 and IF 2)

 

Basically I'm trying instead of having 3 buttons (one for patch #1 and two for criteria #1 and criteria #2), put everything on a single button only.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

This all sounds possible in the OnSelect of a single button. Without seeing your code and error message(s), we can only guess at the issue though. A few pointers that might help you spot a problem:

 

Make sure each function is separated by a semicolon:

Patch(
    // Arguments for Patch here
);
ClearCollect(
    // Arguments for ClearCollect here
);
If(
    // Arguments for first If here
);
If(
    // Arguments for second If here
);

Next, make sure the results coming out of your If() statements are appropriate for an OnSelect property. For example:

If( varNumber > 1, Red, Green)

This statement would not work in an OnSelect because it does not result in an action; it results in a color.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
BCLS776
Super User
Super User

This all sounds possible in the OnSelect of a single button. Without seeing your code and error message(s), we can only guess at the issue though. A few pointers that might help you spot a problem:

 

Make sure each function is separated by a semicolon:

Patch(
    // Arguments for Patch here
);
ClearCollect(
    // Arguments for ClearCollect here
);
If(
    // Arguments for first If here
);
If(
    // Arguments for second If here
);

Next, make sure the results coming out of your If() statements are appropriate for an OnSelect property. For example:

If( varNumber > 1, Red, Green)

This statement would not work in an OnSelect because it does not result in an action; it results in a color.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

@BCLS776 Thank you!

 

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,578)