====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #99-3 MARCH 26, 1999 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * The FoxSolutions Framework Review * More About the May Meeting * Consulting Solutions Group * Tech Tips: The Neglected NVL Function Barbara Peisch Ensuring One Instance of a Form (Denver) Form Object Messaging (Denver) Zipping With Windows Code (Denver) * Other Stuff: Downgrading to FoxPro 2.6 Doug Sherman More on VFP Timing Dan Covill * Administrivia ====================================================================== CALENDAR: April 9 (Note - This is a Friday) Peter Butterfield will return to show us his latest framework. May 5 Tim Daly, one of our new members will show us a VFP6 Network Management System which he developed. Meetings are at 6450 Lusk Blvd (NOT 6540), in the PS business center. From the Lusk Blvd driveway, go straight back to the furthest corner of the rear bldg and park. The conference room is upstairs over the fitness center. ====================================================================== The FoxSolutions Framework Review Our March 3rd meeting was the first hosted by Solutions Consulting at our new regular location (see the Calendar for details). For the program, Bill Heitstuman presented his FoxSolutions Application Framework. Bill's framework started with VFP 3.0, was rebuilt for 5.0, and has now been upgraded for 6.0. His main goals are speed and simplicity; FoxSol doesn't use a lot of builders and it's not geared for Internet development. Bill has made a real effort to keep his class structure shallow, generally one layer above the base class. He points out that multi-level inheritance is a big source of run-time inefficiency. As an example of FoxSol's emphasis on speed, a great deal of effort has been made to ensure Rushmore optimization throughout. Filters are used for queries, and navigation is thru "locate" and "continue". (We asked how he could optimize "goto bottom" using a filter. Bill's simple answer; set order to _descending_ and "goto top"!) The FoxSol classes include a Filter tool, an Order tool, and a Direction tool that can be dropped on a form. These visual tools can also be invoked programmatically. Transaction updating is supported, and navigation while in a form maintains focus on the same field. Bill Heitstuman apparently builds lots of forms containing data from multiple tables, and FoxSol has some unique features to support that. You can have multiple "editors" on a form, each of which has its own set of buttons, its own security, and controls its own set of specific data fields. Another unique feature is "dynamic control hiding". Since each "editor" has its own security, an administrator can select controls to be hidden (invisible) to users with other security levels. Most of us do this in code or as configuration, FoxSol can do it as a normal run-time function of the application The FoxSolutions Framework has its own website at . The framework is for sale in two forms, a Professional Version at $495 or a Standard Version at $295 (the website isn't very clear on what the difference is) and a 600k demo is available for download. I'm not sure what the market is for Yet Another Framework, but Bill's done a lot of work on FoxSol and is justifiably proud of his result. The things I liked about it were his emphasis on run-time performance (sadly neglected by Microsoft) and its obvious intent as a _tool_ for programming rather than a "magic box" to avoid it. One thing becomes apparent as I look at frameworks. None of them is a universal, general tool. Each of them helps you to construct the same kind of application that the framework developer is used to building. If he/she likes pageframes, the framework will help you make pageframes. If he/she likes forms and queries, the framework will help you with forms and queries. If the developer likes menus, there will be a menu builder, otherwise there probably won't. Maybe the way to pick one would be to look at the applications the framework builder has developed; if you like the applications you'll probably like the framework. Dan Covill ---------------------------------------------------------------------- MORE ABOUT THE MAY MEETING Tim Daly's application is deployed on an intranet as an active document. A navigational tool displays a small map of the United States with all of the network elements (nodes) plotted on it. The user clicks on the map at a desired location and a small red rectangle encloses the area which is displayed on the rest of the screen. The nodes and the links between them are laid out on the screen, and the user may click on any item to get detail. Some technical hurdles and solutions: When several links (line objects) overlap, how do you determine which link the user is selecting? How do you display the nodes when they span such a large area like the United States? How is navigation through the network accomplished? How was the application deployed on the intranet? Come to the meeting and find out. ---------------------------------------------------------------------- SOLUTIONS CONSULTING GROUP Our new sponsor... As you know, our new meeting place is at 6450 Lusk Blvd, in the PS business center, and our host is Solutions Consulting Group. But who is SCG, and what do they do? Jonathan Edmett, VP of Marketing, was kind enough to provide the following information. "Since its inception in 1993, Solutions Consulting Group has grown to more than 40 employees with over 65 active clients throughout Southern California. We are a Microsoft Certified Solution Provider Partner and a member of the Oracle Business Alliance Program." They do: Corporate Application Development Solutions Data Warehousing Solutions Network Services They work in FoxPro, VFP, VB, Access, SQL, and Oracle. They are looking for more employees and they do use contractors as well; contact Armando Andrade at if you're interested. For More Information... ====================================================================== TIPS ====================================================================== The Neglected NVL() Function by Barbara Peisch Ever hear of the NVL function? It's been in VFP since version 3.0, but it's surprising how few of us know about it. (I hadn't heard of it until fairly recently.) Essentially, it says, if the expression I'm asking for returns a .NULL., substitute something instead, otherwise, give me what I'm asking for. If you do outer joins, this can be especially useful. Here's an example of how you'd use this function: Select CustName, NVL(InvNum,''), NVL(InvAmt,0) ; from Customers ; left outer join Orders on Customers.CustId = Orders.CustId ; into cursor OrderHist In the example above, I want a list of of all invoices and the amounts, along with the name of the customer who placed the order. The catch is that if there are any customers who've never placed an order, I still want to see their name. In those cases, the invoice number and invoice amount would be .NULL., which can be pretty ugly if you're displaying this info for an end user. By using NVL(), I can specify to return an empty string instead of .NULL. for the invoice number, and 0 instead of .NULL. for the invoice amount. ---------------------------------------------------------------------- ENSURING ONLY ONE INSTANCE OF A FORM Author unknown (from "Fox Footnotes", Rocky Mountain Fox User Group) In the init event of any form place the following code: *----------deny multiple instances of this form from opening local i,windowname,retval retval=.t. i=0 windowname=wchild("",0) && see wchild() function in help do while not empty(windowname) if windowname=upper(this.name) i=i+1 if i>1 retval=.f. exit endif endif windowname=wchild("",1) enddo return retval ** returning .F. from init event of any object cancels creation of ** the instance ---------------------------------------------------------------------- FORM OBJECT MESSAGING Author unknown (from "Fox Footnotes", Rocky Mountain Fox User Group) 1. In the click event of some button or somesuch event of myparentform: do form mychildform with thisform In the init event of mychildform: parameters lomyparent && this receives the object reference ** from the with thisform phrase this.parentfrm=lomyparent && in a property of mychildform ** we put the object reference this.parentfrm.childfrm=this && now we use the object reference ** to give myparentform's property an object ref ** Both forms now have references allowing control of each other's ** properties/methods. 2. Create the right sets of properties and methods in each to create any kind of communication needed. 3. Be sure to handle closing object references before releasing form objects. 4. And if we close myparentform, be sure to close mychildform first. 5. In mychildform's unload event: if type("this.parentfrm")="O" this.parentfrm.childfrm=.f. endif this.parentfrm=.f. 6. In myparentform's unload event: if type("this.childfrm")="O" this.childfrm.parentfrm=.f. this.childfrm.release endif this.childfrm=.f. 7. Run parentfrm, and then after opening childfrm, hold left button down on each form for a second and then letting go with Example Forms. If anyone knows how to improve on this please let me know! [Editor's note: This is a good tip, but it's not very good code! We could read it a lot easier if the author had capitalized a letter or two in his variables. A couple of spaces wouldn't hurt, either. For example, instead of this.childfrm=.f. how about this.ChildFrm = .F. Remember, this is supposed to be for _people_ to read! DC] ---------------------------------------------------------------------- ZIPPING WITH WINDOWS CODE Author unknown (from "Fox Footnotes", Rocky Mountain Fox User Group) Create a new zip file keeping winzip32 minimized: run /n winzip32 -min -a (lcZIPfile) (lcYourFile1) (lcYourFile2) Extract from a zip file w/overwrite and junking paths: run /n winzip32 -e -o -j (lcZIPfile) (lcDirectory) For all the parameters see: command line parameters reference. [This is the tip, verbatim. Without any accompanying explanation, I have to assume that the purpose is to zip/unzip a file from within VFP by using WinZip. Anyway, if whatever this does is what you want to do, then this is how to do it. Although it doesn't say so, I also assume that it would be nice if WinZip32 were on your path. DC] ====================================================================== OTHER STUFF ====================================================================== DOWNGRADING FROM VISUAL FOXPRO: by Doug Sherman, Rocky Mountain Fox User Group During the past few months, I have been contacted by two organizations in the Denver area looking to acquire FoxPro 2.6 for DOS and/or for Windows with distribution kits. These organizations had purchased VFP, but had a need to redistribute a 2.6 application they had purchased with some modifications. The problem was finding a copy of FPD/FPW 2.6. The very real frustration now being experienced is that FoxPro 2.6 DOS and Windows environments are still needed and used by business. With the 2.6 product being out of production and not available from Microsoft, it makes acquiring it impossible at any price. The product is also generally not available on the "recycled software' market. SOLUTION: A short note to Robert Green, Product Manager, Developer Tools, generated the best possible answer for these two groups. He said, "The Professional versions of FoxPro 2.6 DOS and Windows should be available for downgrade from Supplemental Parts." On 3-10-99, I did call Supplemental Parts (800-360-7561). They indicated that a VFP owner may indeed _downgrade to_ FoxPro Windows and/or FoxPro DOS withe proof of ownership of a VFP product (by supplying information from the product box, or the Assy-#s from the VFP CD or diskettes. The cost of the downgrade (diskettes only) is: (1) FoxPro 2.6 Windows Downgrade: $51.96 + 5.00 s/h (includes distribution kit) (2) FoxPRo 2.6 DOS Downgrade: $15.00 + 5.00 s/h (includes distribution kit) (3) A "sidegrade" is also available from Supplemental Parts for those owning the PC product and wanting the Macintosh product, or vice versa. [Well I'll be damned! Common sense rears its ugly head at Microsoft!] ---------------------------------------------------------------------- MORE ON VFP TIMING by Dan Covill As I noted last month, Steve Settimi sent me a program timing search results on a file containing deleted records. I finally got a chance to look at it, and here's what (I think) I found: The file has two million records, every other record is deleted, and the field VALUE contains a (somewhat) random integer. The search is "select max(VALUE) as Nmax from Test" The index was "index on deleted() tag DEL" Conditions deleted OFF deleted ON 1. No index file or tag 12.58 sec 12.11 sec 2. Index present, not used 12.43 9.64 3. Set order to DEL 12.22 9.50 Conclusions: Having an index tag on deleted() provides Rushmore optimization of SQL selects when deleted records are present. It does not matter whether the deleted() tag is the current order or not, but the deleted option must be ON. These conclusions are mine - did I pass the test, Steve? ---------------------------------------------------------------------- Comment spotted on a technical web page: "Windows 98 and Office 98 run reasonably well on a 400 MHz dual-processor Pentium II box." --------------------------Administrivia------------------------------- This newsletter is a service to members of the FoxPro Developers Network of San Diego (FPDN). The editor (Dan Covill) is solely responsible for the content, Barbara Peisch does the distribution. E-mail the editor YOUR tips, comments, complaints, and rebuttals. Editor: Dan Covill 619-272-2448 Board of Directors: Eric Lendvai - President 760-439-6617 Art Bergquist - Vice Pres Claude Nikula - Secretary 619-615-6318 Barbara Peisch - Treasurer 760-729-9607 Randy Barber - Director 619-670-7542 Steve Settimi - Director 619-262-5883 ----------------------------------------------------------------------