Forum Discussion
I have a solution that works for me :
JavaScript does only support integer as number. No supply for BigInt. In TC 11 the handling seems to work different with the used JScript version. It doesn't support BigInt too, but it can handle it somehow (maybe conversion to string or whatever).
However I use ADO for reading my databases. Some fields have the datatype "BigInt" (for example IDs). When I go through the response I chech which datatype is used for the field. BigInt has the property value "25" for the property "DataType". In this case I need to take the "DisplayText" and not the value, like this:
if(obj_SQLObject.Field(i).DataType === 25){
str_Value = obj_SQLObject.Field(i).DisplayText
}
else{
str_Value = obj_SQLObject.Field(i).value
}
The only problem is, that "DisplayText" returns a string. So if it is necessary to work with this value (computing or whatever) you need a workaround. I have created a small lodashfp function, which spilts the string into an array:
var obj_ID = {left: parseInt(_.join("",_.dropRight(4,_.toArray(str_BigInt)))),right: parseInt(_.join("",_.takeRight(4,_.toArray(str_BigInt)))) + int_AddNumber}
return obj_ID.left +""+ obj_ID.right
I'm sure that there is a better solution but it works
Have you tried using aqConvert.VarToInt? (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/vartoint.html)
It might be worth trying to see if TC's conversion routines can do that for you... you might not need that check on DataType. If you still do, than use aqConvert.VarToInt on the DisplayText.
Related Content
- 7 years ago
Recent Discussions
- 2 days ago