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 Apps News & Annoucements carousel

Power Apps News & Announcements

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

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 (5,322)