06-17-2014 04:55 AM
Hi All,
I found an issue during setting the precondition of a steps in Teststand 4.2.1
I have a Statement Step named "Cleanup if WRONG barcode"
AnyOf( RunState.Sequence.Main["ID#:NPMo1DuN+0KuxglET/DQiD"].Result.Status == "Error", RunState.Sequence.Main["ID#:gv4JwcInbU2jx2Ek6SsJ2A"].Result.Status == "Error", RunState.Sequence.Main["ID#:nUMiG7Q3Q0mOkCtVRok26C"].Result.Status == "Error", RunState.Sequence.Main["ID#:5KBfxx3r+ki+2TaRkv0Z3D"].Result.Status == "Error", Parameters.Socket_Data.Product.OrderNumber < 8)
the last argument is Parameters.Socket_Data.Product.OrderNumber that contain the string of the Order number.
The error is the following:
But When I execute the code the Runtime error is not notified, as expected.
Note: in the station Option I have On Runtime error notification "Show Dialog".
Could you please tell me why ?
Thank you very much
06-17-2014 09:54 AM
It's because Parameters.Socket_Data.Product.OrderNumber is a string value that is empty so it cannot be coerced to a number so the expression:
Parameters.Socket_Data.Product.OrderNumber < 8
gives the error you are seeing, but at runtime, the string is set to a number which can then be coerced to an actual number so the expression succeeds at runtime.
You can see this same issue if you create a local variable in a sequence that's a string that's empty and create statement step as follows:
Locals.string < 8
If you do, you will get the same error you are seeing. Then edit the local variable and set it to 10 and look at your expression again. The error is now gone.
You can avoid the error in the statement by either setting the string to an initial value that contains a number (e.g. 0) or change the data type of that variable to a number rather than a string.
Hope this helps,
-Doug
06-18-2014 01:35 AM
OK, I see...
Thank you