If the offer does not work properly

I have the following if if:

if ucase(displayanzeige) = "Y" \ or isnull(displayanzeige) \ and ucase(bstatus) = "2" \ or ucase(bstatus) = "1" 

The first part of the if condition works:

 if ucase(displayanzeige) = "Y" \ or isnull(displayanzeige) 

But the second part does not work:

 and ucase(bstatus) = "2" \ or ucase(bstatus) = "1" 

What is wrong with the if clause? please, help

+4
source share
2 answers

Use parentheses to define your if conditions:

 if (ucase(displayanzeige) = "Y" or isnull(displayanzeige)) and (ucase(bstatus) = "2" or ucase(bstatus) = "1") 

You currently have:

 1 or 2 and 3 or 4 

The system may interpret this as "1 must be true, or 2 and 3 or 4 must be true"

Placement of brackets type:

 (1 or 2) and (3 or 4) 

Tell the system that "1 or 2 must be true and 3 or 4 must be true"

+4
source

Using parentheses is the solution to your problem: -

  if (ucase(displayanzeige) = "Y" or isnull(displayanzeige)) and (ucase(bstatus) = "2" or ucase(bstatus) = "1") 

Currently, the system cannot interpret the conditions as you want it. Using brackets is the best option for you.

+2
source

Source: https://habr.com/ru/post/1448096/


All Articles