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?


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

Reply via email to