My understanding is that RBASE does not use short circuit evaluation.
All comparisons/expressions are evaluated in a command.

Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kramer, Jason J
Sent: Monday, April 22, 2013 8:36 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

This whole discussion about the IF problem has made me curious.  Does any know 
if R:Base uses short circuit evaluation?  If it does, then you can squeeze a 
small amount of additional speed out of your code by putting conditions likely 
to be false first in your AND statements and conditions likely to be true in 
your OR statements.
                                                        Jason

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Javier Valencia
Sent: Monday, April 22, 2013 9:23 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

Gary,

One drawback of the" LIKE" operator is that it is not optimized while the "=" 
operator is. I only used the "LIKE" operator when using wildcards.

Javier,

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


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gary Wendike
Sent: Monday, April 22, 2013 7:03 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

According the help file, LIKE may also be used if the condition is true.  It is 
not limited to be used with a wild card.

It is amazing on the grouping as outlined in your condition -  IF 
(vreq_category = 'S') AND (vsms_access < 40) THEN.  I like the approach, the 
help file does not show this or indicate the concept.

I always think there are many ways to obtain the results.  That to me is the 
nice thing about RBase.  Both statements will obtain the desired results.

Learn something everyday...

Thanks
Gary

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mike Byerley
Sent: Monday, April 22, 2013 2:40 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

That's not going to be helpful, AFAIK.  In the helpfile LIKE is used when the 
condtion may contain wildcard characters and since there is no such condition 
here, there is no work for the LIKE modifier to do.

SET VAR vreq_category TEXT = 'S'
SET VAR vsms_access INTEGER = 30
IF (vreq_category = 'S') AND (vsms_access < 40) THEN

The above evaluates to:

If (true) and (true) then
  -- do something

I am guessing Javier's issue lies somewhere else in his code that is mucking up 
the expression evaluator.  Maybe a boatload of other variables or expressions 
elsewhere within the actual block of code.

I have not seen yet where Javier has rebooted the maching completely and then 
just evaluated the code snippet.  I would to that and that failing, I would go 
after the errant wrong DLLs and not finding any, I would remove and reinstall 
the RBase installation.  But that's just me.






----- Original Message -----
From: "Gary Wendike" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, April 22, 2013 2:20 PM
Subject: [RBASE-L] - Re: IF Question


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