Skip to Content
avatar image
Former Member

Setting characteristic via dependency

Hi,

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?

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Apr 05, 2016 at 09:24 PM

    I think I figured out what was going on, although I don't understand why it was a problem.

    The value that I'm trying to get set YN4 is set up as Restrictable with "Y" and "N" as values. Apparently this setting doesn't play nice with setting the characteristic from a dependency. I created a 5th characteristic YN5, did NOT set it as Restrictable but otherwise the same as my YN4, and the value changes as expected from the dependency.

    I would like to have that restriction on my characteristic though, because I still want it to only be Y or N. As it is, as long as values YN1-3 are all null, YN5 can be anything I type in there. If there is a Y value then it respects the fact that it must be Y and throws an inconsistency error if it's set to another value.

    Any way I can make that restrictable and still be able to set it?

    TIA

    Cathy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 06, 2016 at 03:56 AM

    Hi Cathy Neppel,

    Once check "YN4" is Numeric / Char Format. As your are setting Char value ('Y') via dependency it should be Char Format.


    - Ravikumar B


    Add comment
    10|10000 characters needed characters exceeded