PDA

View Full Version : Version comparison



NewsArchive
02-20-2008, 01:40 AM
Just checking with the experts to make sure I am reading/understanding this
correctly.
Version Equals (less than, greater than, etc.) is what to use to compare
7.00 with 7.01.3482, correct?
It is still value comparison, but handles version style values, right?

ok, I know... it's been one of those days here...

Thanks,
-Glenn.

NewsArchive
02-20-2008, 01:40 AM
Glenn,

Yes, that's correct. The following example displays "Var 2 Greater or Equal
Var 1"

Set Variable %VAR1% to "7.00"
Set Variable %VAR2% to "7.01.3482"

If %VAR1% Version Greater Than "%VAR2%" Then
Display Message Box "Var 1 is Greater Than Var 2" -- ""
Else
Display Message Box "Var 2 Greater or Equal Var 1" -- ""
End

Friedrich

NewsArchive
02-20-2008, 01:41 AM
Ok, that's what I thought, and it is working great.
Thanks for overlooking my "senior moment".

Question, though... what brought this on was I was using a regular "Less
Than" to test a version string. Now, before you jump on me, there was only
one "dot" in the strings.

%OldVersion% came from a GetINI and was 7 (just plain old 7)
I was comparing that to [MyVersion] which is a compiler variable, set to
7.1010

It seems that in this case, it should have passed the "If %OldVersion% Less
Than [MyVersion]", but it wasn't, and much code was getting bypassed.
Unless GET INI returns strings, and Compiler Vars result in "longs"...

So... what are the rules for the regular Less Than, Greater Than, etc.? Why
did this fail before?

Thanks,
-Glenn.

NewsArchive
02-20-2008, 01:41 AM
Glenn,

The installer cannot handle REAL type values. It should have been mention
in the documentation, but it is not :-( We'll add this to the "Remarks"
section.

So the rule for the regular Less Than, Greater Than, etc. is to use LONG
value types.

Friedrich