cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simple math in conditionals

Ok,
This should be easy but I can not find it in the help. I'm setting up conditions for when the user hits the next button in a dialog. I want to launch a dialog if the difference between two numbers (properties) in not 0. It seems that you can only do >,<,= kind of comparisons but not something like
PROP1 <> 0 And ((PROP2 - PROP3) <> 0)
The properties are all numbers but this fails.
(6) Replies
No, MSI condition syntax doesn't support arithmetic; instead of testing if the difference is nonzero, can you test if the two property values exist and are unequal?
I need a value of 0 to do the install. I figured I could not do it in the conditionals so I stated an InstallScript. I have the following but it does not work. Either I missed something or I have it in th wrong place in the sequence. According to the help I have to put it in the exec sequence. I have it after CostFinalize but I don't see my variables change and I don't get the MessageBox. Any Ideas?

function SetUpdateValue(hMSI)
NUMBER nvSize,nvCurr,nvNew,nvDiff;
STRING svNewVersion,svCurrentVersion,svUpdateVal;
begin
nvSize=20;
MsiGetProperty (hMSI, "NEW_VERSION",svNewVersion , nvSize);
MsiGetProperty (hMSI, "IS_STARS_UPDATE", svCurrentVersion, nvSize);
StrToNum(nvCurr,svCurrentVersion);
StrToNum(nvNew,svNewVersion);
nvNew = nvNew-nvCurr;
MessageBox("In InstallScript",INFORMATION);
NumToStr(svUpdateVal,nvNew);
MsiSetProperty(hMSI, "UpdateConditionVal", svUpdateVal);
end;
You'll generally want to reset the buffer-size variable (nvSize) before each call to MsiGetProperty.

If you display the results of MsiGetProperty, are the values what you expect?
I can't seem to verify that the custom action is getting run let alone the values of the Set And Get. I try to use the MSI debugger but it starts to run the program before I can set break points. I don't see my custom action though. Can anyone suggest the best place in the Exec Sequence to place it?
It depends on how you're using the results, but for testing that it's running at all, anywhere in the Execute sequence should be fine.
I don't know why this works. I move the action from the execute sequence to the UI sequence and it works. I get the information I need. It's odd because I saw some notes that say that the get and set should be run in the exec sequence.
Top Kudoed Authors