>Is there any reason to use a #DEFINEd constant instead of a local var? I've seen it done, but am not aware if the rationale, particularly when trying to debug...
Bruce, here is a slightly different way that I use DEFINEs: to access elements in an array. The defines enable me to refers to different array positions with meaningful names.
I know there is a strong trend to tables and cursors and away from arrays, but I still find situations where an array gives me better control on what is happening.
Peter
** declare an array and a local variable:
local lnIT1
private array paItems [1,1]
#define hcPriority paItems[lnIT1,1]
#define hiAITEMS paItems[lnIT1,2]
#define hcItemType paItems[lnIT1,3]
#define hyAmount paItems[lnIT1,4]
#define htEffective paItems[lnIT1,5]
** Fill the array from an SQL select
** Code sample:
for lnIT1 = 1 to alen(paItems,1)
if hyAmount < 0 && credit
lyTotalCR = lyTotalCR - hyAmount && + value
if lyTotalCR >= lySmallChg
ltClose = htEffective
exit
endif
else && debit
if hyAmount < lySmallChg
lySmallChg = hyAmount
endif
if lyTotalCR >= lySmallChg
ltClose = htEffective
exit
endif
endif
endfor
Peter Robinson ** Rodes Design ** Virginia