[Company Logo Image]

Home Up Feedback Search

Services Ed4W & Progress Progress Neat Stuff Links

Of Expander

 

 

Table Names
Check Syntax/Compile
Xref
Section Editor
Load DF
Build Project
Viper Skeletons
Of Expander

Most experienced Progress programmers have learned to avoid the 'of' keyword for joins involving their database tables, because it hides the conditions of the join from the reader, and Progress may choose different fields to join the tables than you expect.  However, it is tempting to use, as a shorthand to listing the field(s) actually needed to join from one table to another in a where phrase.

This enhancement solves that problem.  It lets you write your code with 'of', but then converts it to the 'where' syntax when you run this program.

Here's how it works.  Write a line of code like this:

for each Order of Customer:

Execute the Of Expander with the cursor on the line of code containing the 'of' keyword, and the code is converted to this:

for each Order where Order.cust-num = Customer.cust-num:

To set this up, first download the file TTTEd4W.zip and unzip the file Expand-Of.p to your Progress working directory. 

Next, in Ed4W create a "Build Program" similar to this example.  You may need to modify the command line to account for the directory where Progress resides, any startup parameters required by your application (for example you may need -ininame), and/or your Progress working directory.  

Notes: 

bulletThis program uses the Windows clipboard to transfer text from and to the Ed4W document window.  As a result the contents of the clipboard before execution will be lost.  
bulletBoth tables must be referenced using their actual names, not buffer names.  If you are using a buffer, you could code it initially using the table name, then replace the table name with the buffer name. 
bulletMy program is more forgiving than the actual Progress 'of' keyword; if there is more than one index with matching fields in both tables, it will go ahead and guess at which one to use.
bulletIf you work with multiple projects, each requiring a different database to be connected and a different propath, refer to the Check Syntax enhancement to steps that will enable this to work.
bulletCurrently, the where phrase will be inserted as a single line, without any formatting.  At some point in the future I will probably change this to format the code according to my conventions.  However, it is very unlikely that I will ever format it according to your conventions.
bulletSee the Ed4W FAQ page for steps on adding a toolbar button to execute a command.
 

Click here for your Free Trial copy of ED for Windows, the power packed programmers editor
Click here for your Free Trial of ED4W

 

Copyright © 2005 Tim Townsend Technologies. All rights reserved.
Revised: July 04, 2005 .