Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 consecutive transformations #279

Open
ParvisSchirinov opened this issue Jan 22, 2024 · 1 comment
Open

2 consecutive transformations #279

ParvisSchirinov opened this issue Jan 22, 2024 · 1 comment

Comments

@ParvisSchirinov
Copy link

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants