If 4 = 5 then...

Posted by James Palmer on 13-May-2015 08:48

Been looking at some code (some of the Pro2 triggers etc out of interest), where there are statements like "if 4 = 5 then", or "if yes = no then". 
Can anyone shed any light on what the purpose of this sort of thing is? The then statement has code associated with it. Surely it would never run? 
I've seen this before elsewhere if memory serves.

Posted by Simon L. Prinsloo on 13-May-2015 09:25

Doing old style reports, we often needed to raise the scope of some frames above the FOR EACH which used it, but we did not want it to become visible, as that would print headings where we did not want it.

So we would typically do a 
IF FALSE THEN VIEW FRAME fLines.

somewhere in the procedure block to raise the scope, while it would never actually become visible.


Posted by S33 on 13-May-2015 09:08

It could serve as a way of essentially commenting out code, while making sure it still compiles.

I sometimes use it to force transactions / scoping:

if FALSE then find first my_record.

Why you'd pick "4 = 5" or "yes = no" instead of simply using "FALSE" is probably a matter of personal taste or a method of making it easy to find with a Ctrl-F or a grep command...

All Replies

Posted by S33 on 13-May-2015 09:08

It could serve as a way of essentially commenting out code, while making sure it still compiles.

I sometimes use it to force transactions / scoping:

if FALSE then find first my_record.

Why you'd pick "4 = 5" or "yes = no" instead of simply using "FALSE" is probably a matter of personal taste or a method of making it easy to find with a Ctrl-F or a grep command...

Posted by Simon L. Prinsloo on 13-May-2015 09:25

Doing old style reports, we often needed to raise the scope of some frames above the FOR EACH which used it, but we did not want it to become visible, as that would print headings where we did not want it.

So we would typically do a 
IF FALSE THEN VIEW FRAME fLines.

somewhere in the procedure block to raise the scope, while it would never actually become visible.


Posted by Tim Kuehn on 13-May-2015 09:37

I've done

   FRAME f-name:TITLE = "something." 

There's also: 

  OUTPUT TO /dev/null. 
   VIEW FRAME f-name.
   OUTPUT CLOSE .

 

[collapse]
On Wed, May 13, 2015 at 10:26 AM, Simon L. Prinsloo <bounce-simonvidisolvecom@community.progress.com> wrote:
Reply by Simon L. Prinsloo
Doing old style reports, we often needed to raise the scope of some frames above the FOR EACH which used it, but we did not want it to become visible, as that would print headings where we did not want it.

So we would typically do a 
IF FALSE THEN VIEW FRAME fLines.

somewhere in the procedure block to raise the scope, while it would never actually become visible.


Stop receiving emails on this subject.

Flag this post as spam/abuse.




--
Tim Kuehn:  Senior Consultant  - TDK Consulting Services
President - Ontario PUG 
Program Committee Chair - PUG Challenge Americas, 
Course Instructor: Intro to OO Concepts for Procedural Programmers

Skype: timothy.kuehn
Ph: 519-576-8100
Cell: 519-781-0081
[/collapse]

This thread is closed