Fuel calculation

Dr Panos3 years ago

Hello trying to calculate fuel without device sensor. I am choosing
Fuel
9999999 - 5.5 * totalDistance / 100000
number
The average consumption is 5,5 liters per 100 km. But in reports I am getting this error.
class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')
What can be wrong?

Anton Tananaev3 years ago

It looks like somehow the result of your expression is a string. Can you please provide screenshots of all expressions you have.

Dr Panos3 years ago

Yes this is the expression.
https://drive.google.com/file/d/1WSZEKldECReXmEHPLbPE1wbgSZwsIr2I/view?usp=sharing
It is a custom UI but this is not the issue

Anton Tananaev3 years ago

It is a custom UI but this is not the issue

And what makes you think that? Please provide a screenshot from the database then.

Dr Panos3 years ago

https://drive.google.com/file/d/1ss5GH3x-3PWJV5p88L2bCKOPAOMwdB8U/view?usp=sharing
This is the database.
I am assuming that because several other attributes are working

Dr Panos3 years ago

The attribute is generating a responce like this
Fuel 9997954.7 l Can it be the decimal? , instead of . ?

Anton Tananaev3 years ago

What do you get in the API response?

Dr Panos3 years ago
{"id":36,"description":"Fuel 5,5 lt/100km","attribute":"fuel","expression":"9999999 - 5.5 * totalDistance / 100000\n","type":"Number"}
Anton Tananaev3 years ago

I see multiple issues that are clearly caused by your custom app.

Dr Panos3 years ago

Please can you tell me ?