cancel
Showing results for
Did you mean:
Frequent Visitor

## Invalid results when using logical operators AND and OR in PowerApps

When using a programming calculator or other programming language e.g. VB.NET,

`1 || 0 = 1 // True`

But when using powerapps condition:

`If((1 || 0) = 1, true, false) // False `

Why is that? And how can I achieve the first condition?

I think in PowerApps: And, Or or Not are treated as Boolean. But in a programming calculator or  VB.NET, it is treated as Integer.

So in first equation, the value of `1 || 0` is 1, therefore `1 = 1` is true

But in the second equation, the value of `1 || 0` is false, therefore `false = 1` is false.

I need to be able to use the first equation for my condition. Please help. Thank you.

EDIT:
Some are requesting the whole scenario, so here it a sample use case.

For example I have 3 desks:
ID | Name   | Approver_Set_ID
1  | Desk 1  |  1
2 | Desk 2   | 3
3 | Desk 3   | 7

Then I have the approver set table
Approver_Set_ID | Name
1                          | John
2                          | Paul

For Desk 1, only John can approve the desk reservation. This can be checked by Desk Approver Set ID || Approver's Set ID = Desk Approver Set ID

For Desk 2, both John and Paul can approve the desk reservation, since

3 || 1 (John's) = 3 // True
3 || 2 (Paul's) = 3 // True

Brad cannot approve it because 3 || 4 (Brad's) = 7 // False

For Desk 3, everyone can approve it since 7 || 1, 7|| 2 and 7||4 all equals to itself (7)

In PowerApp's case, it only evaluates if true or false. In my case I want the exact value of the output

2 REPLIES 2
Community Support

Hi @cyberpau ,

Could you please share more details about your scenario? If is possible you could share the whole formula and that would be more helpful.

I made a simple test to show the whole process:

As you see, the IF statement evaluates a test and will return the true value and false value.  On your side, perhaps you could make the evaluation more complete, such as:

If(test value = 1 || test value = 0, true, false)

Hope this helps.

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Frequent Visitor

Hello, apologies for the late reply I was on vacation. Kindly see updated question. Hope it helps.

Announcements

#### December 2023 User Group Update: Welcoming New Groups and Upcoming Events

A new month means it's time to celebrate and welcome the new user groups that have joined our community. We are excited to announce that we have more than 8 New Groups, which is no surprise after the amazing Microsoft Power Platform Conference. This month, we are breaking them out by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you! Don't forget to take a look at the many events happening near you or virtually! It's a great time of year to connect and engage with User Groups both locally and online.   Please Welcome Our NEW User Groups   Power Platform: PowerIT User Group: Nottingham Power Platform User Group: Bergen Power Platform User Group: Danmark Nashville Power Platform User Group Microsoft Ambassador Program y Mujer Latina Technolochicas NCWIT Community Copilot Studio:  Copilot User Group Italia Dynamics365: Dynamics User Group AdriaticDynamic 365 Azerbaijan   December User Group Events   01 Dec 2023 Aprendiendo Desarrollo web, creando mi primer power app y power page. 01 Dec 2023 Q4 Hybrid Philadelphia Dynamics 365 & Power Platform User Group Meeting05 Dec 2023APAC Dynamics 365 FastTrack Bootcamp - BI and Analytics07 Dec 2023Bay Area Power Platform Meetup: Learn, Share, and Connect07 Dec 2023Indiana D365/AX December User Group Meeting07 Dec 2023Dynamics User Group Meeting: Houston09 Dec 2023 December '23 - NEW Power Apps User Group Meeting - Online 12 Dec 2023December Cleveland Power Platform User Group Meeting12 Dec 2023 RW2 Data Stewardship Open Forum Discussion 13 Dec 2023  Black Country Power Platform User Group - December 2023 - West Midlands