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

Hide Features in Custom Setup Dialog by Property [Basis MSI]

Hello,

I 've got a Basic MSI Project which installs different Features and want to hide some Features when property xyz is set.

For understanding: the Setup should be used to install a serverapplication or a clientapplication.

I created a new Dialog and put on two radio guttons in a radio button group and set property to "xyz"
- Radio button 1 -> value 0
- Radio button 2 -> value 1

Features (all installlevel 1):
- Feature1
- Feature2
- Feature3
- Feature4

Feature1 should be only shown by selecting server-setup (xyz=0) and not shown when client-setup (xyz=1) was selected.

So i create a condition in Feature-section for Feature1 like this:
Level: 0 xyz=1


this solution only works if property was set by default but not while running setup.
[in Custom Setup Dialog the Features also shown 😞 ]

I checked with an installScript if the Property set correctly and also tried to create an installscript to disable and hiding Feature with "FeatureSetData" and "FeatureSelectItem" without success.

How can I solve this problem? Other ways are also welcome 😉

----
Thanks for your response
Labels (1)
0 Kudos
(2) Replies
ITI_Randy
Level 6

tteonline wrote:
Hello,

I 've got a Basic MSI Project which installs different Features and want to hide some Features when property xyz is set.

For understanding: the Setup should be used to install a serverapplication or a clientapplication.

I created a new Dialog and put on two radio guttons in a radio button group and set property to "xyz"
- Radio button 1 -> value 0
- Radio button 2 -> value 1

Features (all installlevel 1):
- Feature1
- Feature2
- Feature3
- Feature4

Feature1 should be only shown by selecting server-setup (xyz=0) and not shown when client-setup (xyz=1) was selected.

So i create a condition in Feature-section for Feature1 like this:
Level: 0 xyz=1


this solution only works if property was set by default but not while running setup.
[in Custom Setup Dialog the Features also shown 😞 ]

I checked with an installScript if the Property set correctly and also tried to create an installscript to disable and hiding Feature with "FeatureSetData" and "FeatureSelectItem" without success.

How can I solve this problem? Other ways are also welcome 😉

----
Thanks for your response




You are probably already aware of this, but to simply turn Features on and Off, set your feature’s InstallLevel property to 101 so they will not be installed by default and add a custom action to turn your Feature(s) on based on the results of your Property from your custom dialog. Trigger the custom action on the Next button of your dialog -

//In InstallScript, handle Feature activation as follows:

//To set the Feature to off:
MsiSetFeatureState(hMSI, "MyFeature", INSTALLSTATE_ABSENT);

//To Set Feature States:
MsiSetFeatureState(hMSI, " MyFeature ", INSTALLSTATE_LOCAL);

//Condition the feature in your custome action
if (myPropertyValue = "SomeValue") then
MsiSetFeatureState(hMSI, " MyFeature ", INSTALLSTATE_LOCAL);
endif;

//Set the Next button on your custom dialog to trigger the custom action
Event Argument Condition
DoAction SetFeatureStates 1

If you want to make the Feature invisible in the Custom View, it gets more difficult -

Conditioning is similar but it is necessary to set the Display property of the direct editor table for the Feature in question to a value of 0. Not real easy but I believe it can be done. Is it workable for you to make the property invisible all the time and then turn it on or off depending on you dialog?
0 Kudos
tteonline
Level 2

Thanks for your replay, i didn't recorgnizes it until yet 😞


ITI_Randy wrote:
Conditioning is similar but it is necessary to set the Display property of the direct editor table for the Feature in question to a value of 0. Not real easy but I believe it can be done. Is it workable for you to make the property invisible all the time and then turn it on or off depending on you dialog?


Yes, that's possible!
Setting Feature to install Level 0 is possible but how can I set the Feature back to visible?

I created a Custom Action and run this to set visibility and selected to true (FeatureName = Name of Feature like in Features-table):
FeatureSetData (MEDIA, "FeatureName", FEATURE_FIELD_VISIBLE, TRUE, szData);
FeatureSelectItem(MEDIA, "FeatureName", TRUE);
it doesn't work! Is this command usable if I use Basic MSI and run it with a install script?

I also tried to check the features state with FeatureGetData but this will return a value less than 0 (=error).
0 Kudos