# Need help with Apama EPL

**URL:** <https://community.cumulocity.com/t/need-help-with-apama-epl/620>\
**Category:** Forum\
**Tags:** analytics, Streaming-Analytics-Apama, cumulocity\
**Created:** [August 11, 2022, 3:12pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620 "2022-08-11T15:12:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![strasser.manfred](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/strasser.manfred/32/32198_2.png) [@strasser.manfred](https://community.cumulocity.com/u/strasser.manfred)\
**Post date:** [August 11, 2022, 3:12pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/1 "2022-08-11T15:12:19Z")

</div>

Hi Community,  
please see my question below.

#### What product/components do you use and which version/fix level?

Cumulocity  
Backend: **1011.0.12**  
UI: **1010.0.24**

#### Are you using a free trial or a product with a customer license?

License

#### What are trying to achieve? Please describe in detail.

I try to write an EPL flow to create an operation for a device.

It only works when I remove line (1),

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/8/0/8038680dab0cda41b2aa301b93c36ed99325b437.png)

then I can Set the Parameters as direct input in the Field like this

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/3/2/3259b2d213602983c6f4c4dd304ef0b7507cc18c.png)

Resulting in

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/e/8/e8781cc4b973421031f3a5bf2a17b95cdc987f0a.png)

Now, what I need to have instead of “my Command” - I need to have a fragment & value of an Event Object (the last occurrence of an Event)

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/a/b/abd3eb8f3beea70c865c51bd8d8906378144283f.png)

But I just cant manage to extract this fragment from the Event Object and also I can not manage to send the fixed values necessary to the input channel of the Operations creator.

Which block I need to use to extract?

Any help is much appreciate.  
Also, if there is a place where I can find sample flows of EPL I would like to check out working solutions…

Thank you very much  
BR Manfred

---

<div class="post-metadata">

**Author:** ![Gyanendra\_Singh\_Bais](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/gyanendra_singh_bais/32/31950_2.png) [@Gyanendra\_Singh\_Bais](https://community.cumulocity.com/u/Gyanendra_Singh_Bais)\
**Post date:** [August 12, 2022, 9:27am UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/2 "2022-08-12T09:27:55Z")

</div>

Hi,

You can use the Extract Properties block (Eigen­schaft extrahieren) to extract properties from the incoming event. You can combine the extracted properties with additional values using the Set Properties block (Eigenschaften festlegen). See the example below:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/f/c/fc6bdad08e87b6399df5cf3e7ffedeeb869f81d9.png)  
[extract properties.zip](https://community.cumulocity.com/uploads/short-url/nQ0L3bUR8kkqPvk3QsGzxetdqGl.zip) (951 Bytes)

Thanks,  
Gyan

---

<div class="post-metadata">

**Author:** ![Gyanendra\_Singh\_Bais](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/gyanendra_singh_bais/32/31950_2.png) [@Gyanendra\_Singh\_Bais](https://community.cumulocity.com/u/Gyanendra_Singh_Bais)\
**Post date:** [September 1, 2022, 12:33pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/3 "2022-09-01T12:33:15Z")

</div>

Hi BR Manfred,

Is the issue resolved for you or do you need further help on it?

Thanks,  
Gyan

---

<div class="post-metadata">

**Author:** ![strasser.manfred](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/strasser.manfred/32/32198_2.png) [@strasser.manfred](https://community.cumulocity.com/u/strasser.manfred)\
**Post date:** [September 1, 2022, 7:35pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/4 "2022-09-01T19:35:31Z")

</div>

Hello Gyan,  
sorry for not replying and thank you for reaching out again.

I was on holidays and afterwards - not surprisingly - there was waiting some urgent matters I had to handle.

But no, I still could not finish this task.

Maybe you could take a look on my trial, attached.  
Instead of an event I would like to use for the basic test a contant value.

None of the parameters are used on the operation. Only an operation is created, nothing more.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/c/6/c6ef5b91abc4c01b334969479dd3514df704bd84.png)

In the Shell there is nothing, means also “c8y\_Command” is not recogniced.

Thank you in advance.  
BR  
Manfred  
[Timer1 (3).zip](https://community.cumulocity.com/uploads/short-url/1nkNxJRNYUnFFN0GIJR1nCg0MJk.zip) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![Gyanendra\_Singh\_Bais](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/gyanendra_singh_bais/32/31950_2.png) [@Gyanendra\_Singh\_Bais](https://community.cumulocity.com/u/Gyanendra_Singh_Bais)\
**Post date:** [September 2, 2022, 9:06am UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/5 "2022-09-02T09:06:43Z")

</div>

The model you attached currently generate following operation json:

```auto
{
  "Description": {
    "value": "myTestOperation"
  },
  "creationTime": "2022-09-02T08:17:17.347Z",
  "ParameterValue": {
    "value": "Para-Value"
  },
  "apama_analytics_modelName": "Timer1",
  "OperationName": {
    "value": "c8y_Command"
  },
  "self": "http://t322920.latest.stage.c8y.io/devicecontrol/operations/1205204",
  "ParameterName": {
    "value": "Para-Name"
  },
  "id": "1205204",
  "deviceId": "1194307",
  "deviceName": "dev_1",
  "modelTime": "2022-09-02T08:17:16.300+00:00",
  "status": "PENDING"
}

```

So Extract Properties and Set Properties block are working properly. But I suppose this is not the JSON format you want?  
For comparison, if you directly specify values in the output block instead of using the properties, following Operation json is generated:

```auto
{
	"creationTime": "2022-09-02T08:59:48.673Z",
	"deviceId": "1194307",
	"deviceName": "dev_1",
	"self": "https://t322920.latest.stage.c8y.io/devicecontrol/operations/1205213",
	"id": "1205213",
	"status": "PENDING",
	"apama_analytics_modelName": "Timer1",
	"c8y_Command": {
		"Para-Name": "Para-Value"
	},
	"description": "myTestOperation",
	"modelTime": "2022-09-02T08:59:47.600+00:00"
}

```

To help you properly with this, can you provide following details:

- The exact JSON format of the Operation you want to create.
- Part of the operation data which would be fixed
- Part of the operation data which comes from incoming Event
- The JSON format of the incoming Event or exact JSON format of the Event data which you want to extract

Thanks,  
Gyan

---

<div class="post-metadata">

**Author:** ![strasser.manfred](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/strasser.manfred/32/32198_2.png) [@strasser.manfred](https://community.cumulocity.com/u/strasser.manfred)\
**Post date:** [September 4, 2022, 6:45pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/6 "2022-09-04T18:45:09Z")

</div>

Hi Gyan  
I just tried for some time, but I just cant figure out how it really works. So I will provide you the necessary information. In advance a big Thank You for your time and support.

First - the Event I need to extract some information.  
On the other hand, at the moment, I don’t see any disadvantage in sending the complete information with the Operation (all text that I receive from the Event)

But absolutly necessary is **c8y\_ua\_DataValue.value.value: 5.0**

```auto
       {
            "creationTime": "2022-09-01T20:59:29.672Z",
            "source": {
                "name": "V2-EVENT (CCC-0)",
                "id": "40345879"
            },
            "type": "f5sMachineStateOPC",
            "lastUpdated": "2022-09-01T20:59:29.672Z",
            "time": "2022-09-01T22:59:25.096+02:00",
            "id": "45938246",
            "text": "Maschinen Status",
            "c8y_ua_SourceNodeId_ns=6;s=::OPCUaMappi:OPCInterf.WriteMES.c8yMaschinenStatus.Status": {},
            "c8y_ua_DataValue": {
                "sourceTimestamp": 133065395650965765,
                "serverTimestamp": 133065395650965765,
                "value": {
                    "value": 5.0
                },
                "statusCode": 0
            }
        },

```

The Operation I want to create is this

```auto
            "description": "connectionStatus update",
            "ConnectionStatus": {
                "text": "*TEXT FROM EVENT GOES HERE*"
            },

```

What I find - and dont know how to solve: When I use the “Operations Output” block with direct filling in of the parameters (without “live” data from the event), the operation created looks like this

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/1/b/1b0a41680b50bff9796f2012c9256d2a2c19e0fe.png)

But when I connect the “SetParameter” Block to merge live data from Event, it looks different. I refer to your remarks on the answer from you…

I hope I could provide you with all necessary information.

Thank you a lot  
BR Manfred

---

<div class="post-metadata">

**Author:** ![strasser.manfred](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/strasser.manfred/32/32198_2.png) [@strasser.manfred](https://community.cumulocity.com/u/strasser.manfred)\
**Post date:** [October 22, 2022, 7:11pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/7 "2022-10-22T19:11:34Z")

</div>

Hi Gyan,  
in the mean-time this issue is solved.  
Thank you for spending your time on the issue and helping me.  
Finally solution is cascading the “set-property” blocks to get the structure I need.

Thanks again  
BR Manfred

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [April 20, 2023, 7:12pm UTC](https://community.cumulocity.com/t/need-help-with-apama-epl/620/8 "2023-04-20T19:12:02Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
