table query return null

table query return null

amy_milesB7Q7X
Advocate Advocate
13 Views
2 Replies
Message 1 of 3

table query return null

amy_milesB7Q7X
Advocate
Advocate

[ FlexSim 24.1.0 ]

I have a table query and if it can't find a value, i get a null value and an exception error. How can i change this query to return a 0 if nothing is found?


double bpm=0;



Table result=Table.query("SELECT [Nominal] FROM Packing_BPM_Rates_Analog WHERE ([Material]=$1)", token.Material);

if (result.numRows>0)

return bpm=result[1][1];

return 0;

0 Likes
14 Views
2 Replies
Replies (2)
Message 2 of 3

jason_lightfootVL7B4
Autodesk
Autodesk
Can you either post the exception message or the model please?
0 Likes
Message 3 of 3

amy_milesB7Q7X
Advocate
Advocate

Yes, let me start a new post and i'll share model link.

0 Likes