eclipse-basyx / basyx-databridge

Eclipse Public License 2.0
9 stars 13 forks source link

2 consecutive transformations #279

Open ParvisSchirinov opened 5 months ago

ParvisSchirinov commented 5 months ago

We are trying to chain 2 transformations consecutively (see below). If we use only one of them, it works. If we use both and simply output a value from one, it works. However, as soon as both are supposed to perform calculations, we encounter a null pointer error.

{ "datasource": "myFillLevelSensor", "transformers": ["testTransform1", "testTransform2"], "datasinks": ["FillLevelHttpDatasink"], "trigger": "timer", "triggerData": { "timerName": "timer1 } },

Here under Transformers. If we remove one or modify the function of one in a way that it doesn't use a variable, it works.

For testing purposes, we simply take a variable with a fixed value. In one instance, we add 1 to this variable in Transformation 2, and in another, we just multiply it by 1000 in Transformation 1

testTransform1.jsonata $floor(fillLevel * 1000)

testTransform2.jsonata $floor/fixValue + 1)

FrankSchnicke commented 5 months ago

Hi,

I'm assuming that fillLevel & fixValue are values from your JSON? After applying the first transformation, the output is an integer (e.g., 10) and thus, the second transformation can't find the fixValue and fails. Can you try $floor($ + 1) instead?