Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The biggest mistake of the season :)
Message
From
24/05/2006 13:09:11
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01124333
Message ID:
01124584
Views:
14
local laProblemTxt[5], laProblemFlag[5]
        * should be in setup code or table driven... 
        * not inited again and again...
	laProblemTxt[1] = " payment arrangements"
	laProblemTxt[2] = " recent payments"
	laProblemTxt[3] = " been recently billed"
	laProblemTxt[4] = " some process pending"
	laProblemTxt[5]	= " recent status changes"

        *-- Short and sweet if it is only flags!
	laProblemFlag = 0

* Processing code
for lnI = 1 to Alen(laProblemTxt)
    if laProblemFlag[lnI] > 0
	.cProblemText = .cProblemText + "," + CRLF + ;
	transform(laProblemFlag[lnI]) + ;
	iif(laProblemFlag[lnI] > 1, ;
	" accounts have", ;
	" account has") + laProblemTxt[lnI]
     endif
next
if not empty(.cProblemText)
   .cProblemText = substr(.cProblemText,4) + "."
endif
why couple the flags and the text in 1 Array ?
It is easier to code in 2 arrays and lets you decouple the constant text...
Also independant of later additions to the error state.

regds

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform