Unable to store correct value returned from database select query
Hi,
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.
β
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:
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/methods.html