1 Reply Latest reply: Jan 28, 2013 7:41 AM by 865393 RSS

    How to count instances using a conditional attribute which returns unknown

    751286
      Hi

      I am having a problem in counting instances when using some conditional attribute.

      The rule is pretty simple

      the mechanic has more than 3 cars waiting to be worked on if
      the number of cars waiting to be worked on > 3

      the number of cars waiting to be worked on = InstanceCountIf(the cars, the car is waiting to be worked)

      This solution doesn't work when you have only one instance which has the attribute value as unknown (even though you may have several instances with attribute value true)

      The users manual explicitly state that the function will not work. However I was wondering if you have any better solution than my one below using a rule table:


      the mechanic is busy if

      the mechanic has more than 3 cars waiting to be worked on

      the number of cars waiting to be worked on > 3


      the car will count as worked on

      0 -> it is unknown whether the car is waiting to be worked on

      0 -> it is uncertain whether the car is waiting to be worked on

      0 -> the car is not waiting to be worked on

      1 -> the car is waiting to be worked on

      0 -> otherwise

      the number of cars waiting to be worked on = InstanceSum(the cars, the car will count as worked on)


      Essentially we just want to test if the function when the attribute returns TRUE. There is a logical function for "It is not true" but no one for checking if the Boolean is TRUE.

      Cheers,

      Edited by: Paulo Gottgtroy on 25/01/2013 00:16

      Edited by: Paulo Gottgtroy on 25/01/2013 00:18
        • 1. Re: How to count instances using a conditional attribute which returns unknown
          865393
          Paulo,

          If I understand you correctly, the trick is to use the "is currently unknown" operator. I tried the rules below and they worked as far as what I expected. If you start a test case, and just add one car (and set no attribute values) then the number of cars waiting to be worked on starts at 0 (zero).

          the number of cars waiting to be worked on = InstanceCountIf(the cars, the car will count as waiting to be worked on)

          the mechanic is busy if
          the mechanic has more than 3 cars waiting to be worked on
          the number of cars waiting to be worked on > 3

          the car will count as waiting to be worked on if
          it is currently known whether or not the car is waiting to be worked on and
          it is certain whether or not the car is waiting to be worked on and
          the car is waiting to be worked on

          Please email me at michael.fairweather@monadsolutions.com if you would like me to send you the OPM project files.

          Cheers,
          Michael.

          Edited by: Michael Fairweather on Jan 28, 2013 5:40 AM