4 Replies Latest reply on Aug 22, 2013 4:37 AM by Rajan.Panchal

    InstanceCount() function

    Rajan.Panchal

      Hi,

      I want to know if there are no instances for an entity then does InstanceCount() function returns zero or uncertain?

       

      Thanks,

      Rajan

        • 1. Re: InstanceCount() function
          Ian Clough-Oracle

          If you know there are no instances then InstanceCount() will return zero, if you don't know there are no instances then it will return uncertain. To clarify, if the containment relationship to the entity is complete, then the you know how many instances there are, the relationship will be complete if the entities have been collected on an entity collection screen or if the data has been loaded from a connector and the relationship marked as complete.

           

          You could write a rule which uses InstanceCount() and returns zero if it is unknown if for example you skip the entity collect screen in some circumstances.

          • 2. Re: InstanceCount() function
            Rajan.Panchal

            Hi Ian,

            I am still not clear about that..

            For your information I am using an emebbed determination server and create entity through java api's offered by OPA and dont have any screens. What I have observed in my rule base is that for some entites it returns zero for instance count when no instance are present for that entity whereas for some entity it returns zero.

             

            Thanks,

            Rajan

            • 3. Re: InstanceCount() function
              Ian Clough-Oracle

              Do you have a simple test case that you could post here? Which API's are you using and how are you using them. In general when you use the Java APIs then you need to set the containment complete flag to indicate that no more entities are expected and then InstanceCount() should not return unknown.

               

              Also could you specify which version of OPA you are using and have you tried to reproduce with the latest release 10.4.4?

              • 4. Re: InstanceCount() function
                Rajan.Panchal


                For API details you can refer to OPA developer help. I cannot post that code here.  We are using OPA 10.4.2.18

                Yes. Ithnik may be the entities are not marked complete thats why I am getting unknown for some entities.