Unable to store correct value returned from database select query
I'll try to explain the problem with as much detail as possible. In summary I'm trying to read a value from the db and use it in my scripts.
I created a db table variable using database query, query select is "select FIRST 1 ORDER_ID from ORDERS ORDER by ORDER_TIME desc"
When I view the result from the edit DB table variable value, it returns correct expected number which is a numeric value as per the DB schema.
but when I try to read this value in my code using lastOrderID = Project.Variables.OrderID.Value["ORDER_ID"], I get this value which is alpha numeric with decimals in it.
This is what I get when I try to add database table checkpoint
Can someone help me identify what's wrong here? I have tried retrieving this value using direct script, creating a db table variable and using db query and finally using datatable table checkpoint wizard. No success so far.
Solved! Go to Solution.
Since you are not doing calculations on Order ID, I suggest storing it as a string and working with it that way in your test. That will avoid the conversion error that you are seeing.
You can use aqConvert to accomplish this:
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.