I’m trying to check if an integer is -1 in a product table, -1 is our indication it has to be ordered.
getProdDetails.data.prodDetailQuery[0].onHand > 0 ? 'On Hand' : 'Will Be Ordered'
Returns NaN
So I’m missing something.
I’m trying to check if an integer is -1 in a product table, -1 is our indication it has to be ordered.
getProdDetails.data.prodDetailQuery[0].onHand > 0 ? 'On Hand' : 'Will Be Ordered'
Returns NaN
So I’m missing something.
You’re trying to apply min (a function for numbers only) to the On Hand or Will Be Ordered strings
I’m not sure why you’re using min if accessing [0] element of the array as there should only be one value
You should be able to do something like this:
getProdDetails.data.prodDetailQuery[0].onHand == -1 ? 'Will Be Ordered' : 'On Hand'
I updated the post, maybe it’s not showing yet. But i changed to that and it’s still returning NaN. I may mis understand how they’ve implemented ternary conditionals.
i thought was condition check, true(?) do this else ( : ) do this?
here’s the current code and still returning NaN:
getProdDetails.data.prodDetailQuery[0].onHand > 0 ? 'On Hand' : 'Will Be Ordered'
That’s correct
What is output if you just use {{getProdDetails.data.prodDetailQuery[0].onHand}}
on the page?
Screen shot:
Never mind… maybe it didn’t save correctly or i forgot to refresh the page… it’s working all of a sudden.
it won’t let me mark your reply as the answer