I got this caution while binding a query to this property. As I binded the expected datatype "Integer". But it is showing the expected error "string found" . how to resolve this
Show us your binding. (If it's an expression then please post </> formatted code rather than a picture of code.)
Its a Query Binding
Select Top 1 PF from Main WHERE BG =:bg and Plant =:pl and Line=:ll and Machine =:ma and
Date between :st and :sp
order by Date desc
[
{
"type": "ia.chart.simple-gauge",
"version": 0,
"props": {
"minValue": -2,
"maxValue": 1,
"startAngle": 0,
"arc": {
"color": "#008000"
},
"arcBackground": {
"color": "#008000"
},
"label": {
"visible": false
},
"animate": true,
"style": {
"classes": []
}
},
"meta": {
"name": "SimpleGauge"
},
"position": {
"basis": "300px"
},
"custom": {},
"propConfig": {
"props.value": {
"binding": {
"type": "query",
"config": {
"returnFormat": "scalar",
"queryPath": "Online_PF",
"parameters": {
"ll": "{..../Line_Dropdown.props.value}",
"st": "{..../DateTimeInput.props.value}",
"ma": "{..../Machine_Dropdown.props.value}",
"bg": "{view.params.BG}",
"pl": "{view.params.Plant}",
"sp": "dateArithmetic({..../DateTimeInput.props.value}, 1, \"days\")"
}
}
}
}
}
}
]
What data type is the database field PF? If it's a string or text then that's probably your problem.
I can reproduce the error by creating an expression binding with the simple expression "-0.99"
which, of course, is a string.
If you can't fix the DB then try adding an expression transform on the binding.
toFloat({value})
Thanks for the suggestions.I have added the Expression transform. Now it works well.
Or change the query, which would be a touch more performant:
SELECT Top 1 CAST(PF as float)
FROM Main
WHERE BG =:bg
AND Plant =:pl
AND Line=:ll
AND Machine =:ma
AND Date BETWEEN :st AND :sp
ORDER BY Date DESC
2 Likes