create cursor mycursor (yellow c(1), grin c(1), blue c(1),total i) >insert into mycursor (yellow,grin,blue) values ('','Y','Y') >insert into mycursor (yellow,grin,blue) values ('Y','','Y') >insert into mycursor (yellow,grin,blue) values ('Y','Y','Y') >insert into mycursor (yellow,grin,blue) values ('','Y','') >insert into mycursor (yellow,grin,blue) values ('Y','','Y') >insert into mycursor (yellow,grin,blue) values ('','Y','Y') >insert into mycursor (yellow,grin,blue) values ('Y','','') > >select mycursor >scan > replace mycursor.total with ?&&count of columns with 'Y' value (0/1/2/3) >endscan
Update mycursor set total=iif(yellow='Y',1,0) + iif(grin='Y',1,0) + iif(blue='Y',1,0)