Need help with EPL

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),

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

Resulting in

image

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)

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

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:


extract properties.zip (951 Bytes)

Thanks,
Gyan

Hi BR Manfred,

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

Thanks,
Gyan

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.

In the Shell there is nothing, means also “c8y_Command” is not recogniced.

Thank you in advance.
BR
Manfred
Timer1 (3).zip (1.2 KB)

The model you attached currently generate following operation json:

{
  "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:

{
	"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

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

       {
            "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

            "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

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