I developed a log system in gINT (8.2.800) that has been pretty reliable in Windows XP and Vista 32-bit. However, we have started getting an error in a worksheet table I created in Windows 7. The error is:
gINT Rules Code execution error
Error Text = (10080) Type Mismatch.
Line 224
Line 224 is checking to see if the variant type variable that takes the value of a boolean entity (the boolean is coming from a checkbox in the gINT worksheet table) is true or false.
The relevant code is as follows:
...
Dim Boo_Check As Variant
' Determine the field positions of the necessary fields in the array. If InitFieldsFnB(Field_Classify, iPsClassify, Field_Desg, iPsDesg, Field_Class_Override, iPsClass_Override) Then Exit Sub End If ' Start process of analyzing data input For lrow = 1 To glNumRows Boo_Check = gsDataA(iPsClass_Override,lrow) If Boo_Check = False Then ' Reset values for start and end points start_pt = 0 end_pt = 0 ....
The error occurs at the orange fill text. The iPsClass_Override column is a simple boolean checkbox. If it is checked, the program skips the code, if it is unchecked, it runs the code. The oddity is that this error doesn't always occur in Windows 7. When it originally happened to me, after wasting 10 to 15 minutes trying to figure out what was going wrong, I closed gINT, restarted gINT and things operated as they would in a 32-bit system. That solution, however, isn’t working well for others in Windows 7.
Any ideas?
You are assigning "False" to Boo_Check, so that is a string variant. Then you compare a string ("False") to a Boolean (False). Seem like a recipe for errors.
I suggest you declare Boo_Check as a Boolean, then have
Boo_Check = CBool(gsDataA(iPsClass_Override,lrow))
But i'm concerned about the string array returning an empty string. So you should check for "" or len > 0 before doing the CBool.
Phil WadeDatgelBentley Channel Partner and Developer PartnerE: phil.wade@datgel.com | T: +61 2 8202 8600 & +65 6631 9780
Get the most out of gINT with Datgel Tools.
Thanks for the response. Appreciate the help and comments.
I thought False would be taken to mean False as in Not True, not "False" as a string. If I wanted the code to check to see if the value was equal to a string value of false, wouldn't I need to type: If Boo_Check = "False" ?
I did modify the code however, since writing the OP. I began trying to see what gsData is capturing and then returning. I printed out the gsData and it was coming out as 0. I changed Boo_Check to an integer, but then got a type-mismatch in my 32-bit system. Then I changed Boo_Check to a string and then asked for it to see if the cell equaled a string value of "0" instead of an integer of 0. That made the code work again in the 32-bit system. It seems to appear that gsData is retrieving the cell data as strings and not based on the actual variable type within the cell.
From a user, it sounds like that has corrected the error in Windows 7, at least for now. I think my change is making the comparison apples to apples.
The statement:
is the declaration. What Phil suggested is that you change this declaration to:
Dim Boo_Check As Boolean
That limits the valid settings for Boo_Check to True or False. (The Variant data type is defined as "An empty, numeric, currency, date, string, object, error code, null or array value." Note that Boolean is not one of the included variants, so it would be interpreted as the next closest option, a string.)
My original code had Boo_Check as a Boolean, but I received a Type Mismatch error in the line above the orange text when I did that. This was the original reason why I made Boo_Check a variant.
Thanks for the info on the Variant data type. If that is the case, that seems to indicate that gsData is indeed outputting strings instead of whatever is originally in the cell.