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

Need help with "Or" function.

Spoiler
 

I've been trying to play around with the function called "Or" but I am not getting it right.

My current script is this but I have more of these ThisItem.1, ThisItem.2, ThisItem.3 that needs to be check.

  With(
    {
        DDate: DateDiff(
            Today(),
            ThisItem.FO_OUT,
            Days
        )
    },
    If(
        DDate <= 30,
        LightCoral,
        DDate <= 90,
        Yellow
    )
)

 

 Essentially, if (DDate or this or this or this) is true then light coral ,etc.

Help please

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @Shazarul ,

 

Could you tell me:

  • Do you want to use the or identifier in the If() function when you have more columns?

 

If my assumption is correct, I've made a test for your reference::

 

1\ This is my list LIST32.

v-xiaochen-msft_0-1607924846343.jpeg

 

v-xiaochen-msft_1-1607924846343.png

 

 

2\ Add a gallery control to test.

 

3\ Insert a label control into the gallery control and set its color property to:

With({DDate:DateDiff(Today(),ThisItem.FO_OUT,Days)},If(DDate<=30 Or ThisItem.'Test 1'<53 Or ThisItem.'Test 2'<34,LightCoral,DDate<=90,Yellow))

 

4\ The result is as follows:

v-xiaochen-msft_2-1607924846345.png

 

Best Regards,

Wearsky

View solution in original post

4 REPLIES 4

@Shazarul 

 

The Or function only returns boolean like this:

 

 

 

Set(_Var01,Or(true,false))

 

 

 

In example above, _Var01 would have the value true

 

Instead of true and false above inside the Or, you can use any formula that returns this kind of values as well inline if you want.

 

You can use like this in If statement:


 

 

Set(_Var02,If(Or(true,false),"possible","impossible"))

 

 

 

In above example, the Or will always return the true result. So in If it will always go to the first or true branch of that formula, so only "possible" is possible in the above example.

 

Makes sense?

 

Check if above helps. 

v-xiaochen-msft
Community Support
Community Support

Hi @Shazarul ,

 

Could you tell me:

  • Do you want to use the or identifier in the If() function when you have more columns?

 

If my assumption is correct, I've made a test for your reference::

 

1\ This is my list LIST32.

v-xiaochen-msft_0-1607924846343.jpeg

 

v-xiaochen-msft_1-1607924846343.png

 

 

2\ Add a gallery control to test.

 

3\ Insert a label control into the gallery control and set its color property to:

With({DDate:DateDiff(Today(),ThisItem.FO_OUT,Days)},If(DDate<=30 Or ThisItem.'Test 1'<53 Or ThisItem.'Test 2'<34,LightCoral,DDate<=90,Yellow))

 

4\ The result is as follows:

v-xiaochen-msft_2-1607924846345.png

 

Best Regards,

Wearsky

Refer to the post below, unable to delete this post.

DateDiff(start_date, end_date, unit). My end_date consist of my many variables, ThisItem.FO_Out, ThisItem.KMC_Out, ThisItem.Test1, ThisItem.Test2, etc. 

How do I declare that many var within that DateDiff function.

Edit: I just saw an Or function inside that If function. What?!!!! Just like that and it works?!

Thanks a bunch!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (2,185)