Javier,  replace  the "=" comparison on the text value with "LIKE".  It should 
work then.  Here is the code I just ran and everything worked as it should.

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30
IF vreq_category LIKE '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

Gary




________________________________
From: Javier Valencia <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Mon, April 22, 2013 11:41:58 AM
Subject: [RBASE-L] - Re: IF Question


Bill,
 
I copied the code Dennis had verbatim and it did not run.
I compared setting with the previous version where it ran correctly and the 
setting were identical.
As a last resource, I disconnected, shut the session down and re-stared r:base 
and now it works correctly.
I will have to remember the next time something does not work as it should, Now 
I am wondering what else could have changed if all the settings seem to be 
correct. Is this something that can happen or has already happened to a live 
application that I did not know?
Fortunately, users of the critical live applications are never logged in for 
than 10 hours per day. My development session had been up for several days as I 
normally do not shut my computer down; I will have to keep this in mind.
Thanks to all for the feedback.
 
Javier,
 
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137
 
From:[email protected] [mailto:[email protected]] On Behalf Of Bill Downall
Sent: Monday, April 22, 2013 11:14 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question
 
Javier,
 
Copy and paste your own code from the email thread, and see if it works for 
you. 
Maybe there's an invisible spurious character in your actual code that isn't 
showing up in the emails.
 
Bill
 
On Mon, Apr 22, 2013 at 9:10 AM, jan johansen <[email protected]> wrote:
Yep. Works for me as well
R:BASE eXtreme 9.5 (64), U.S. Version, Build: 9.5.2.20328.
 
>-----Original Message-----
>From: "Paul Buckley" <[email protected]>
>To: [email protected] (RBASE-L Mailing List)
>Date: Mon, 22 Apr 2013 12:01:51 -0400
>Subject: [RBASE-L] - Re: IF Question
>Javier, 
> 
>I copied Dennis’ code and it ran in my copy of the same version you have, 
>R:BASE 
>eXtreme 9.5 (64), U.S. Version, Build: 9.5.2.20328.
>  
>Just so you know,
>Paul Buckley 
> 
>From:[email protected] [mailto:[email protected]] On Behalf Of Javier Valencia
>Sent: Monday, April 22, 2013 11:51 AM
>To: RBASE-L Mailing List
>Subject: [RBASE-L] - Re: IF Question
> 
>Dennis, 
>  
>I copied and pasted the code just like you had it, traced it and skips the 
>pause 
>command every time.
>  
>I am running version: 
>R>show version
>R:BASE eXtreme 9.5 (64), U.S. Version, Build: 9.5.2.20328
>  
>Now I am really confused…
>  
>On a lark, I ran it under an older version:
>R>show version
>R:BASE eXtreme 9.1 (64), U.S. Version, Build: 9.1.5.20510
>And it work correctly.
>  
>All the settings seem to be the same. I will send a sample to RBTI.
> 
>Thanks to all that replied. What version are you all running?
>  
>Javier, 
> 
>Javier Valencia, PE
>O: 913-829-0888
>H: 913-397-9605
>C: 913-915-3137
>  
>From:[email protected] [mailto:[email protected]] On Behalf Of Dennis McGrath
>Sent: Monday, April 22, 2013 10:00 AM
>To: RBASE-L Mailing List
>Subject: [RBASE-L] - Re: IF Question
> 
>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]] 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 
>Sent:Monday, April 22, 2013 7:57 AM
>To:RBASE-L Mailing List 
>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.< br>
>TIA.
>
>Javier,
>
>Javier Valencia, PE
>O: 913-829-0888
>H: 913-397-9605
>C: 913-915-3137

Reply via email to