Hello im a beginner in cspro logic. Say for instance i have list of commodity codes for crops
Example 124020, 124040, 124041, 124042 and so on.
I want to prevent the enumerator or keyer to enter the same commodity code which was already used..because its not usual to entry same crop on the same plot.
Thank you in advance
Logic code for capturing duplicate entries on crop commodity code on a roster
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Logic code for capturing duplicate entries on crop commodity code on a roster
Try this.
Code: Select all
PROC CropName
string StoreString=strip($);
numeric index=count(CropID where strip(CropName)=strip(StoreString));
if index>1 then
errmsg (You can not enter %s twice ", strip(StoreString) );
$="";
reenter;
else
endif;
Re: Logic code for capturing duplicate entries on crop commodity code on a roster
Thanks for the reply. Will it work if may list of commodity codes are store in valueset?
Re: Logic code for capturing duplicate entries on crop commodity code on a roster
The logic is a bit different for a value set. Search for the word "ranking" on this forum and you will find some examples: search.php?keywords=ranking
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Logic code for capturing duplicate entries on crop commodity code on a roster
PROC CropName
numeric index=count(CropID);
if index>1 then
errmsg (You can not enter %s twice ", getlabel(CropName_V1, CropName));
$=notappl;
reenter;
else
endif;
numeric index=count(CropID);
if index>1 then
errmsg (You can not enter %s twice ", getlabel(CropName_V1, CropName));
$=notappl;
reenter;
else
endif;