paodelta
Posts: 15
Joined: Thu Jan 25, 2007 12:50 pm
Location: Italy

install level based on a condition

I'm trying to set the install level based on a condition for one of the features.
I've created a new dialog with a radio button group and 2 radio button. A new user defined property (i.e MY_PROP, with value "mu" or "cs", default value "mu" as the corresponding radio button is checked by default) is linked to the radio button group. In the feature (i.e. MY_FEAT_10) property page I cancel the content of "Install level" box and in the Conditional Level Dialog I insert two condition: the first is MY_PROP = "cs" with level 4, the second is MY_PROP = "mu" with level 0.
I thought that in the customize setup dialog (for custom setup type) MY_FEAT_10 would be present only when I click the radio button that makes MY_PROP equal to "cs" and it wouldn't be present otherwise. The result is different, MY_FEAT_10 never appears, despite the value of MY_PROP.
I've tried to set 4 and 1 in the install level box but MY_FEAT_10 never appears, despite the value of MY_PROP.
What's wrong?
The help for the conditional level dialog says "This dialog contains a list of condition/level pairs. Each level will be set if the corresponding condition evaluates to True.", and this seems what i need....
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

I'm afraid that changing the InstallLevel for a feature cannot be done from UI because it's to late for that, the InstallLevel is set under CostFinalize standard action. And the "CostFinalize" standard action gets executed before the radio group property is changed.

Another approach will be to use a custom action. Please see following post for similar approaches:
http://www.advancedinstaller.com/forums ... stalllevel
http://www.advancedinstaller.com/forums ... stalllevel

Hope this helps.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
paodelta
Posts: 15
Joined: Thu Jan 25, 2007 12:50 pm
Location: Italy

it doesn't work....

Hi Gigi,
i've tried what suggested in the 1st topic (as follow), but it dosn't work...
In the "Organization" page remove all conditions used for your features. Set 1 as InstallLevel value for each feature.

Switch to "Custom Actions" page and create a "New Attached Custom Action" (select the .vbs file) under "UI Custom Actions" section. the "Function Name" field must be empty.

The .vbs file must be like this:

Code:
if Session.Property("FEATURE_PROP") = 1 then
Session.FeatureRequestState("Feature") = 2
else
Session.FeatureRequestState("MainFeature") = 2
end if


Where FEATURE_PROP is the property of the radio group control. In the dialog where resides the radio group control you need to add a new published event under the next control like this:
Name: DoAction
Argument: select the custom action previously added.

Note that AI currently does not support to change the name of a feature (can be changed only the title). So your features name looks like this: MainFeature, Feature, Feature1, etc.
I've created a new project (very simple, with very few elements) and I can post the .aip and .vbs files to the Support Team email address if you think that it's useful...

Best regards,
Paolo
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Paolo,

Note that those modifications are not reflected in the UI. After installation you will see those modifications. Here is a script example for two features:

Code: Select all

if Session.Property("FEATURE_PROP") = 1 Then 'radio 1 is selected
	Session.FeatureRequestState("Feature1") = 3 'will be installed
	Session.FeatureRequestState("Feature2") = 2 'will not be installed
Else 'radio 2 is selected
	Session.FeatureRequestState("Feature1") = 2
	Session.FeatureRequestState("Feature2") = 3
end if 
Note that Feature1, Feature2 are the features identifier located in the "Organization" page. FEATURE_PROP is the property of the RadioButton group and 1,2 are the values for the radio buttons in group.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
paodelta
Posts: 15
Joined: Thu Jan 25, 2007 12:50 pm
Location: Italy

Note that those modifications are not reflected in the UI.
Is It possible that the modifications will be reflected in the UI? This is, indeed, what I'd like to see...

If it's not possible I'll try another approach...

Thanks,
Paolo
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Paolo,

I'm afraid that the changes are not reflected in the UI because the InstallLevel is set under "CostFinalize" standard action. And the "CostFinalize" standard action gets executed before the RadioButton group property is changed.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
paodelta
Posts: 15
Joined: Thu Jan 25, 2007 12:50 pm
Location: Italy

different approach

Okay, I get it.

I've choosen a different approach.

In the Install Parameters page I've defined to properties:
- VIEWFEATURE1 with value 0
- VIEWFEATURE2 with value 0

Then I set Instal Level with condition for Feature_1 and Feature_2 as follow:
- Feature_1 default I.L. = 0, condition VIEWFEATURE1 = 1 to set install level 1 (or 4)
- Feature_2 default I.L. = 0, condition VIEWFEATURE2 = 1 to set install level 1 (or 4)

Then I will set VIEWFEATURE1 = 1 or VIEWFEATURE2 = 1 as command line option when executing the setup procedure. With this solution the UI is as I need:

Code: Select all

+ Mainfeature     or        + Mainfeature
+ Feature_1                 + Feature_2
Thanks for your help
Paolo

Return to “Common Problems”