Garret, Keep the extract/sort separate and call a procedure which returns back the list you want in a separate cursor. The mainline process then would simply process the returned cursor regardless of whether it is a full list or a version list. It keeps the logic simple and also encapsulates the "extract/sort" code in one place which is easy to handle when it changes - which you know it surely will.
Dave Crozier The secret to staying young is to live honestly, eat slowly, and to lie about your age -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Garrett Fitzgerald Sent: 08 September 2006 01:30 To: ProFox Email List Subject: Philosophical question on program structure I wrote a program to sort a address list by zipcode. Nice and straightforward. Then it growed. :-) I added functionality for it to sort a single list into multiple versions. To do this, I created a cursor with the versions in it and skipped through the cursor, sorting once for each version. Only problem is, this doesn't work well if you don't have versions. :-) The solution I came up with involved wrapping all the accesses to crsrVersion so that they wouldn't be accessed if they didn't exist. a) IF llMultiVersion GO 1 IN crsrVersions ENDIF FOR i = 1 TO lnVersionCount *!* Sort the versions IF llMultiVersion SKIP IN crsrVersions ENDIF ENDFOR IF llMultiVersion USE IN crsrVersions ENDIF On one hand, this is good, because it keeps the sort code in one place. On the other hand, it's kinda fugly. Possible solutions: b) IF llMultiVersions *!* Sort multiple versions ELSE *!* Sort one version ENDIF This might be cleanest, but it puts the main point of the program, the SORT/COPY FOX2X code, in two different places. c) IF NOT llMultiVersions CREATE CURSOR crsrVersions INSERT INTO crsrVersions ENDIF *!* Sort multiple versions, possibly for values of multiple *!* equal to 1. This is probably the way I should go, but it involves creating a cursor which might not be semantically needed. So, what do you think? a, b, or c? [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

