Hi,
Yeah we believe the issue is referencing the same UO dynamic array on the same
line.
We have also sent this off to Rocket and are waiting their response.
We have fixed the issue as you said by assigning the Val function to a variable
first.
It's just a little scary to think of the millions of lines of code in our
application and what other conditional statement may not be calculating
correctly.
This means we are having to do a search and replace to find all instances where
we are doing a Val in a conditional statement.
Regards
Adrian Halid
Senior Analyst/Programmer
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P: (08) 9315 7000 F: (08) 9315 7088
E: adrian.ha...@itvision.com.au W: http://www.itvision.com.au
___
NOTICE : This e-mail and any attachments are intended for the addressee(s) only
and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any attachments) by an
unintended recipient
is prohibited. If you are not the intended recipient please contact the sender
as soon as
possible by return e-mail and then delete both messages.
___
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brett Callacher
Sent: Friday, 12 November 2010 6:16 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Val on UniDynArray produces unexpected results
I think you will find that the problem here is two expressions, on the same
line, that reference the same UO dynamic array. Assign your Val functions to
variables first and then use these variables in your case statement.
HTH
Brett
Adrian Halid adrian.ha...@itvision.com.au wrote in message
news:13e4ae055d203648a4121114f2458c8c9f16a05...@tefnut.perth.itvision.com.au...
Hi All,
We have come across a very strange bug between UniDynArray and VB6.
In our applications we were getting two different results on an if statement
between the IDE and the compiled (into Native) exe.
In the IDE case the statement was returning True which is correct.
In the compiled native exe the exact same statement was returning false which
is wrong as the statement should evaluate to true.
If we compiled the exe into p-code then the statement evaluates to True as it
should.
The conditional statement seems to have to be in this exact structure (kind
of like a perfect storm of conditions).
((var1.Field(1).StringValue ) Or (False And
Val(var1.Field(2).StringValue) 0))
It must compare the same UniDynArray in each part of the if statement and
perform a Val on the second UniDynArray.
The issue can be demonstrated by the sample code below.
We have two Booleans (b1 and b2) that should always evaluate to true.
In the VB6 IDE b1 is true and b2 is true as expected.
In the Compile Native exe b1 actually evaluates to false. (This is wrong b1
and b2 should always be True).
---
Dim var1 As UniDynArray
Dim b1 As Boolean
Dim b2 As Boolean
Set var1 = New UniDynArray
var1.Field(1).StringValue = 1
var1.Field(2).StringValue =
' b1 and b2 should always be True
' When compiled into Native Code b1 is false and b2 is true. Why?
b1 = ((var1.Field(1).StringValue ) Or (False And
Val(var1.Field(2).StringValue) 0))
b2 = ((False And Val(var1.Field(2).StringValue) 0) Or
(var1.Field(1).StringValue ))
MsgBox b1= b1 and b2= b2
---
I know we can fix the problem quickly by swapping round the conditional
blocks or create new variables to hold the string values and then compare
them.
My concern is that in our very large application what conditional statements
could be failing in the executable we send out.
Regards
Adrian Halid
Senior Analyst/Programmer
IT Vision Australia Pty Ltd (ABN: 34 309 336 904)
PO Box 881, Canning Bridge WA 6153
Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153
P: (08) 9315 7000 F: (08) 9315 7088
E: adrian.ha...@itvision.com.aumailto:adrian.ha...@itvision.com.au
W: http://www.itvision.com.auhttp://www.itvision.com.au/
___
NOTICE : This e-mail and any attachments are intended for the addressee(s)
only and may
contain confidential or privileged material. Any unauthorised review, use,
alteration,
disclosure or distribution of this e-mail (including any