I'm trying to write a custom CEP rule that creates an operation for an agent to gather the measurement that caused the rule to trigger. The CEP rule looks like this:
insert into CreateOperation
select
OperationStatus.PENDING as status,
"5345" as deviceId,
{
"c8y_GetData", {
"name": "get measurement data",
"measurementID": measurementEvent.measurement.id.value,
"measurementType": measurementEvent.measurement.type
}
} as fragments
from MeasurementCreated measurementEvent
where measurementEvent.measurement.type = "c8y_TemperatureMeasurement";
When I'm using simple strings for the measurementEvent.measurement... fields (e.g. "testString") the rule works. But those lines cause errors when typed like in this example. Changing the ":" to "," like in examples from the documentation makes the rule work but the result is
"name",
"get measurement data",
"measurementID",
"176438",
"measurementType",
"c8y_TemperatureMeasurement"
which doesn't work as key,value pair like "name": "get measurement data" would have. Trying to encapsulate fragments within fragments doesn't seem to work either.