Setting characteristic via dependency
I have a characteristic that I would like to set based upon the values in other characteristics. There are 3 characteristics (char 1), which if any of the three are set to "Y" I want a 4th to get set to "Y".
So I set up a numeric characteristic that will just hold the number of "Y" values in char's 1-3 above. I have a procedure dependency that counts the number of "Y"s and stores the count to this numeric characteristic. This works great.
The next step is to set the 4th Y/N char if the counter > 0. This is what I cannot get to work.
I have been able to set a second numeric characteristic in the same dependency so that is not the issue.
This is what my dependency has in it:
$SELF.set_counter = 0,
$SELF.set_counter=set_counter + 1 if YN1='Y',
$SELF.set_counter=set_counter + 1 if YN2='Y',
$SELF.set_counter=set_counter + 1 if YN3='Y',
$SELF.YN4='Y' if set_counter>0
The set_counter gets properly set as the values YN1-3 change to and from "Y".
But the "YN4" never gets set to "Y". Ever.
I have tried putting the last line in a second dependency thinking maybe there's an issue of setting a numeric and character value in the same dependency but that didn't work either.
For grins, I also threw this line at the bottom, to make sure I could change 2 characteristics in the same dependency. The value gets set just fine.
$SELF.set_counterx2 = set_counter* 2
Can anyone tell me what I'm doing wrong?