I have a number input component that I am using as part of query in this way
and data['localDate']::timestamp between CURRENT_TIMESTAMP - INTERVAL '{{ numberInput1.value }} days' AND CURRENT_TIMESTAMP
When I hover over the numberInput1.value it gives me the correct value (whatever is in the component), however, when executing it, this gives me an error - Cannot cast '$1 days' of type text to type interval
If I just hardcode a number like
and data['localDate']::timestamp between CURRENT_TIMESTAMP - INTERVAL '5 days' AND CURRENT_TIMESTAMP
then the query works.
I've tried value.toString(), value.toFixed(), but nothing works.
Totally understand your desire to keep the field as a number. I think that should be possible but worst case you might have to set the value as a string and do some converting just to get things working smoothly.
That new error you have is very odd, I don't think I have seen a 'too short' error before could you share a screenshot of this error and the query/resource?