I tried this and it works correctly

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30
IF vreq_category = 'S' AND vsms_access < 40 THEN
   pause 1 using 'works'
endif


Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Javier Valencia
Sent: Monday, April 22, 2013 9:02 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

Alastair,

I have tried with and without parentheses and also each individual expression 
with and without parentheses with the same result. I am baffled.

Javier,

Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]]<mailto:[mailto:[email protected]]> On Behalf Of 
Alastair Burr
Sent: Monday, April 22, 2013 2:12 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

Javier,

I don’t think you need the brackets around the two statements, so:
IF vreq_category = 'S' AND vsms_access < 40 THEN ...
should work.

Regards,
Alastair.

From: Javier Valencia<mailto:[email protected]>
Sent: Monday, April 22, 2013 7:57 AM
To: RBASE-L Mailing List<mailto:[email protected]>
Subject: [RBASE-L] - IF Question

I have variable in code  that I need to check to verify if the process can
continue. I have two defined variables:

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30

Now, if vreq_category = 'S' AND vsms_access is less than 40 then an warning
message is generated.
If vreq_category is not equal to 'S" then no warning is issued.
If vrew_category = 'S' and vsms_access is eaula or greater than 40 then no
warning  is issued.

The following code works correctly"

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30
IF vreq_category = 'S' THEN
   IF vsms_access < 40 THEN
      SET VAR vMsg = ('You need SMS access level 40 or higher' + CHAR(13) +
      + 'To create Sign work Order.' + CHAR(13) )
      PAUSE 2 USING .vMsg CAPTION 'System Message...' +
      ICON Warning +
      BUTTON 'Press any key to continue...' +
      OPTION THEMENAME &vUser_theme
      GOTO Done
   ENDIF
ENDIF
...
LABEL Done

Now, if I combine the IF statements, the warning code is bypassed:

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30
IF (vreq_category = 'S' AND vsms_access < 40) THEN
  SET VAR vMsg = ('You need SMS access level 40 or higher' + CHAR(13) +
  + 'To create Sign work Order.' + CHAR(13) )
  PAUSE 2 USING .vMsg CAPTION 'System Message...' +
  ICON Warning +
  BUTTON 'Press any key to continue...' +
  OPTION THEMENAME &vUser_theme
  GOTO Done
ENDIF
...
LABEL Done

If I change the "AND" to "OR" the code is executed, but I need it to
evaluate both conditions at the same time and not one or the other.

I don't know if I am too sleepy and can't see the obvious but I would think
that both snippets of code should work...I am probably overlooking something
obvious.

TIA.

Javier,

Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137

Reply via email to