jlavery
Posts: 27
Joined: Tue Oct 14, 2008 4:56 pm

Set a property from a combo and then set others

Hi everyone,
I'm putting together an installer for a web appliation.

I've got a custom dialog, where I've got a combo in which the user can select either TEST or LIVE for the installation.

Dependent on the result of this combo, I want to change the application directory, and also some other installation properties.

I've set the combo to have a property of TARGET_SYSTEM.

Specifically, I want to be able to edit my web.config to set the datasource according to whether it's TEST or LIVE. I anticipate doing this by having another Installer property of DATASOURCENAME, which I can set accordingly depending on whether it's a TEST or LIVE installation.

However, I'm having problems getting the Combo box to update the TARGET_SYSTEM property. Also, how can I then set DATSOURCENAME accoring to the value of TARGET_SYSTEM. I want to do something like:

Code: Select all

IF TARGET_SYSTEM = 'TEST'
  DATASOURCENAME = 'Tst_datasource'
ELSE
  DATASOURCENAME = 'LiveDatasource_001'
ENDIF
Can someone please point me in the right direction?

Thanks,

James
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Set a property from a combo and then set others

Hi,
I'm having problems getting the Combo box to update the TARGET_SYSTEM property.
Can you give me more details about this? What is the exact behavior you are encountering?
how can I then set DATSOURCENAME accoring to the value of TARGET_SYSTEM
For this you can use SetProperty published control events for the "Next" button of the custom dialog. For example, the control events can look like this:

Code: Select all

[DATSOURCENAME]      "Tst_datasource"          TARGET_SYSTEM = "TEST"
[DATSOURCENAME]      "LiveDatasource_001"      TARGET_SYSTEM = "LIVE"
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlavery
Posts: 27
Joined: Tue Oct 14, 2008 4:56 pm

Re: Set a property from a combo and then set others

Hi Cosmin,
Thanks for getting back to me.

I think I've sorted out the problem with TARGET_SYSTEM being updated from the combo, thanks.

For setting the DATASOURCENAME, can you give me details on how to actually set this up? I can see the logic of what you've said, and it makes sense to me, but I can't see how I actually set this up using the SetProperty event. Do you have a step-by-step example?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Set a property from a combo and then set others

Hi,

Please note that in my previous post the "SetProperty" word uses a link to a how-to in the User Guide:
Set property on button push

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlavery
Posts: 27
Joined: Tue Oct 14, 2008 4:56 pm

Re: Set a property from a combo and then set others

Hi Cosmin,
Thanks - I've already read this how-to but I don't think it gives enough detail.

How do I actually configure the SetProperty to give me:
[DATSOURCENAME] = "Tst_datasource" when TARGET_SYSTEM = "TEST"
and
[DATSOURCENAME] = "LiveDatasource_001" when TARGET_SYSTEM = "LIVE"?

The how-to indicates that I can set one property from another, but doesn't go into enough detail for the scenario I'm describing.

Sorry if I'm being dim here!

Regards,

James
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Set a property from a combo and then set others

Hi James,

When creating a published control event the Edit Control Event dialog is shown. In this dialog you can set the following:

Name:
- select "SetProperty" from the combo, the edit will be set to "[PropertyName]"
- set the edit to:

Code: Select all

[DATSOURCENAME]
Argument:
- set this field to the value you want in the property:

Code: Select all

Tst_datasource

Condition:

- click the "..." button in this field to show the Edit Condition dialog
- in this dialog set the "Expression" edit to the condition you want:

Code: Select all

(TARGET_SYSTEM = "TEST")
- click OK in the "Edit Condition" dialog

After setting these edit controls you can click OK in the "Edit Control Event" dialog in order to obtain this control event:

Code: Select all

[DATSOURCENAME]      Tst_datasource          AI_INSTALL AND (TARGET_SYSTEM = "TEST")
You can use the same approach for the second control event. For more details about how a "SetProperty" control event works, please see this article.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlavery
Posts: 27
Joined: Tue Oct 14, 2008 4:56 pm

Re: Set a property from a combo and then set others

Hi Cosmin,
Thanks - that's explained it to me!

I hadn't realised that the condition editor was used like that - I had it in my head that it was to do with general installation conditions....

James

Return to “Common Problems”