cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular 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
4                          | Brad

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
Microsoft
Microsoft

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:

6.png

 

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.

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

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (61,278)