Dear CSPro Team;
I am getting the error in “CSPro 7.3.1” on the following logic:
keylist(LISTING_DICT_NSER,caseIdList);
if length(caseIdList)>0 then
do numeric keyCtr = 1 while keyCtr <= length(caseIdList)
numeric household_number = tonumber(caseIdList(keyCtr)[32:3]);
enddo;
LISTING_DICT_NSER.HOUSE_NUMBER=Household_number+1;
else
LISTING_DICT_NSER.HOUSE_NUMBER=1;
endif;
When I declare variable “household_number” outside the loop then it is okay. Otherwise it gives error.
It is working fine in CSPro 7.1.3.
Best.
a.
ERROR(HOUSE_NUMBER, 17): 'Household_number' is not a declared variable or is a misspelled dictionary entry
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
-
- Posts: 1777
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: ERROR(HOUSE_NUMBER, 17): 'Household_number' is not a declared variable or is a misspelled dictionary entry
CSPro has the concept of variable scope, so the variable household_number is only accessible within the loop. In the same way, a variable declared in one PROC isn't accessible in another PROC. In CSPro 7.3, we modified the compiler to support dot notation, and as part of that we tightened the scoping rules, so that's why it worked in CSPro 7.1 but not 7.3.
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan