Hop
Posts: 13
Joined: Mon Feb 15, 2010 2:22 pm

HowTo define Property as Null

I would like to define a property to have no initial value but have it available elsewhere in the project when in the string and condition wizards. Is there any character sequence the "New Property" dialog (version 9.0.1) will translate to a null (no) value?
I've tried several guesses including the

Code: Select all

{}
suggested by topic http://www.advancedinstaller.com/forums ... =2&t=19629 , but they are all treated as literals.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: HowTo define Property as Null

Hi,

In order to achieve what you want you should proceed as follows:
- go to "Custom Actions" page and create a "Property set with formatted" custom action with sequence under "Wizard Dialogs Stage" -> "Begin" standard action
- set "Property Name" field to your property name (i. e. MYPROP)
- set "Formatted Text" field to:

Code: Select all

{}

Let us know if this helps, otherwise please give us more details about your scenario.

Regards,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Luke
Posts: 22
Joined: Thu Oct 11, 2012 11:00 am

Re: HowTo define Property as Null

The Custom Action solution given above does allow the Property to be set to Null but seems to have a side effect of ignoring any value passed in on the command line using the MSI MY_PROP="myValue" syntax. (I'm guessing that the Custom Action fires after command line parameters are considered, thus overwriting the value with NULL?)

Is there any way to set the default value of a Property to Null but still allow its value to be passed in on the command line?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: HowTo define Property as Null

Hello,

Please keep in mind that in order to have the NULL value a property can be removed from "Install Parameters" page. In this way (if the property is not defined) the default property value will be NULL until it will be initialized (e.g. from command line or by an installer event or action). So, if you want to have a property with a NULL default value, then it is enough to not define it in "Install Parameters" page. Thus, the property will be defined and initialized the first time it is used in the installation process (e.g. when it is set from command line or during a condition evaluation).

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Luke
Posts: 22
Joined: Thu Oct 11, 2012 11:00 am

Re: HowTo define Property as Null

Thanks for your reply. That solves my problem (I didn't realise that I could simply remove the property from the 'Install Parameters' page and yet still bind it to a simple edit control).
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: HowTo define Property as Null

You're welcome.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”