Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-8944

[fiware-stackoverflow] Array Condition within EPA CEP PROTON

    Details

      Description

      Created question in FIWARE Q/A platform on 29-09-2016 at 17:09
      Please, ANSWER this question AT https://stackoverflow.com/questions/39774810/array-condition-within-epa-cep-proton

      Question:
      Array Condition within EPA CEP PROTON

      Description:
      Using CEP Proton I want to check if, for the events received in a time interval, the id of the second and following events is contained in an attribute of type array coming in the first event. Let's say the first event is coming with the attribute called group that is an array of integers (10, 20, 30). The following events will come with an id, ex 20, 25 and so on. I want to check if the id of those events is included in the attribute group included in the first event.
      For that I have created a condition in EPA

      ArrayContains(ArrayGet(myevent.group,0),ArrayGet(myevent.id,ArraySize(myevent.id)-1))

      However I'm getting an error when I click on verify

      Error Error in EPA: expression error of undefined myepa

      Am I doing anything wrong?
      Cannot I access to the attribute array using ArrayGet? Or maybe ArrayContains cannot work with the result of ArrayGet?

      JSON

      {"epn":{"events":[{"name":"GupsyContextUpdate","createdDate":"Thu Sep 29 2016","attributes":[

      {"name":"entityId","type":"String","dimension":0}

      ,

      {"name":"entityType","type":"String","dimension":0,"description":"The cost of this event occurrence. Negative if this is an opportunity"}

      ,

      {"name":"SF","type":"Integer","dimension":0,"description":"Used in case the this event occur within an interval"}

      ,

      {"name":"occupied","type":"Integer","dimension":"0"}

      ,

      {"name":"framecounter","type":"Integer","dimension":"0"}

      ,

      {"name":"RSSI","type":"String","dimension":"0"}

      ,

      {"name":"hwversion","type":"String","dimension":"0"}

      ,

      {"name":"swversion","type":"String","dimension":"0"}

      ,

      {"name":"compassz","type":"String","dimension":"0"}

      ,

      {"name":"MACBS","type":"String","dimension":"0"}

      ,

      {"name":"SNR","type":"String","dimension":"0"}

      ,

      {"name":"devEUI","type":"String","dimension":"0"}

      ,

      {"name":"battery","type":"String","dimension":"0"}

      ,

      {"name":"devicetype","type":"String","dimension":"0"}

      ,

      {"name":"compassx","type":"String","dimension":"0"}

      ,

      {"name":"compassy","type":"String","dimension":"0"}

      ,

      {"name":"compasst","type":"String","dimension":"0"}

      ,

      {"name":"neighbours","type":"String","dimension":"1"}

      ,

      {"name":"timestamp","type":"String","dimension":"0"}

      ]},{"name":"gupsyoutput","createdDate":"Thu Sep 29 2016","attributes":[

      {"name":"Certainty","type":"Double","defaultValue":"1","dimension":0,"description":"The certainty that this event happen (value between 0 to 1)"}

      ,

      {"name":"OccurrenceTime","type":"Date","dimension":0,"description":"No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters"}

      ,

      {"name":"ExpirationTime","type":"Date","dimension":0}

      ,

      {"name":"Cost","type":"Double","dimension":0,"description":"The cost of this event occurrence. Negative if this is an opportunity"}

      ,

      {"name":"Duration","type":"Double","defaultValue":"0","dimension":0,"description":"Used in case the this event occur within an interval"}

      ,

      {"name":"test","type":"String","dimension":"1"}

      ]}],"epas":[{"name":"gupsyepa","createdDate":"Thu Sep 29 2016","epaType":"Aggregate","context":"gupsyct","inputEvents":[

      {"name":"GupsyContextUpdate","alias":"gupsyupdate","consumptionPolicy":"Consume","instanceSelectionPolicy":"First"}

      ],"computedVariables":[

      {"name":"count","aggregationType":"Count","gupsyupdate":"ArrayContains(ArrayGet(gupsyupdate.neighbours,0),ArrayGet(gupsyupdate.id,ArraySize(gupsyupdate.id)-1))"}

      ],"assertion":"count == true","evaluationPolicy":"Immediate","cardinalityPolicy":"Single","internalSegmentation":[],"derivedEvents":[{"name":"gupsyoutput","reportParticipants":false,"expressions":{"Duration":"0","test":"ArrayContains(ArrayGet(gupsyupdate.neighbours,0),ArrayGet(gupsyupdate.devEUI,ArraySize(gupsyupdate.devEUI)-1))"}}]}],"contexts":{"temporal":[{"name":"gupsyct","createdDate":"Thu Sep 29 2016","type":"TemporalInterval","atStartup":false,"neverEnding":false,"initiators":[

      {"initiatorType":"Event","initiatorPolicy":"Ignore","name":"GupsyContextUpdate"}

      ],"terminators":[

      {"terminatorType":"RelativeTime","terminationType":"Terminate","relativeTime":"15000"}

      ]}],"segmentation":[],"composite":[]},"consumers":[{"name":"gupsyconsumer","createdDate":"Thu Sep 29 2016","type":"Rest","properties":[

      {"name":"URL","value":"http://127.0.0.1/ProtonParser/TestEvent2Log.php"}

      ,

      {"name":"contentType","value":"application/xml"}

      ,

      {"name":"formatter","value":"xml"}

      ,

      {"name":"delimiter","value":";"}

      ,

      {"name":"tagDataSeparator","value":"="}

      ,

      {"name":"dateFormat","value":"dd/MM/yyyy-HH:mm:ss"}

      ],"events":[

      {"name":"gupsyoutput"}

      ]}],"producers":[],"name":"gupsy"}}

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 15:12|CREATED monitor | # answers= 2, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 15:12|CREATED monitor | # answers= 2, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 18:09|UPDATED status: transition Answer| # answers= 2, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 18:09|UPDATED status: transition Answer| # answers= 2, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 21:09|UPDATED status: transition Finish| # answers= 2, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 21:09|UPDATED status: transition Finish| # answers= 2, accepted answer= True

          People

          • Assignee:
            backlogmanager Backlog Manager
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: