Mike,

A few years ago I did a big cleanup of the application and most of the older 
code was scrubbed to conform to the new recommended coding procedures, no 
variable definition within WHILE loops, change set variable...to  SQL 
SELECT...INTO ..., and so on.
In any case, this particular session was being used exclusively for form design 
with essentially all the code being data validity checking and cosmetics 
details, no fancy coding or loops to speak of.
What is interesting is that this code worked:

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

But this code did not work 

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

As it turned out, the first snippet is optimized while the second is not as per 
"UnderstandingWHILELoopOptimization.pdf" downloaded  from the "From the Edge" 
documents which states:

>>>
WHILE and IF commands are only optimized where they use a single condition 
comparing values. If
expressions are used the command is not optimized. The comparison operator must 
be =, <>, >, >=,
<, or <=. The operators IS NULL, IS NOT NULL, LIKE, NOT LIKE, BETWEEN, IN and 
NOT IN
are not optimized. For example:

IF vType IN ('A','B') THEN -- is not optimized

IF vType = 'A' AND vType = 'B' THEN -- is not optimized

IF vType = 'A' THEN
        IF vType = 'B" THEN -- is optimized
<<<

I would have thought that two combined comparisons would be faster than 2 
single comparisons. I knew that he the LIKE operator was not optimized, and I 
only use it in conjunction with 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 Mike Byerley
Sent: Monday, April 22, 2013 5:06 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: IF Question

If the same session is running days on end, then I would look for parts of your 
RBase code that historically had caused memory leaks, principally within while 
loops.  Razzak has some standard ABCs of practice that you might reinvestigate 
to be sure you are following the rules.

Frankly, it does sound like you are doing something like that.


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


Mike

If you look at the post (below) before the one you replied, you will note I 
mentioned that shutting down the r:base session and restarting it, took care 
of the issue. That particular session had been running for several days as I 
don't normally shut down the computer at the end of the day (auto backups 
take place at 3:00AM).
BTW, I had cleared all variables and run the bare code, so there were no 
other code or variables interfering at the time. It seems that over time 
something got out-of-whack.

While at it, I have also noticed that when running R:Base, every so often I 
get the "application not responding" Windows message at the top of the 
window and if I wait a couple of seconds it goes away and the application 
resumes normally. I have the power setting on "High performance"  and the 
disk is not going to sleep. I am running a Dell with Windows 7 and Intel 
I7-2630 QM quad-core and 6GB of memory; I wonder if anyone else has run into 
this. R:Base is the only application that does this.

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