PDA

View Full Version : Setting variables based on dialog controls



ekramer11
07-12-2006, 05:13 PM
I'm new to Installshield. I've been hunting around a lot on the knowledge base, documentation and forums and I'm not finding the answer I need. This prompts me to ask for assistance.

I am using a basic MSI project in VS 2005.

I am attempting to modify a .Net Config file as a result of options the user has selected.

I am attempting to set a variable called ZZ_AUTH_TYPE to a value depending on if the user selected windows or sql authentication in the SqlLogin dialog.

I am attempting to do this using events in the Next button of the SqlLogin dialog. Thus far I've been unable to actually get it to work but I believe it is because of a lack of understanding of events..

The control on the dialog that I am attempting to use is IS_SQLSERVER_AUTHENTICATION1 ( which represents Windows authentication mode ).

I've tried the following:

Event: DoAction
Argument: ZZ_AUTH_TYPE=WIN
Condition: IS_SQLSERVER_AUTHENTICATION1=1

and I've tried:
Event: ZZ_AUTH_TYPE
Argument: WIN
Condition: IS_SQL_SERVER_AUTHENTICATION1=1

Does anyone have any advice on this?

thanks
Ed

Christopher Painter
07-12-2006, 08:06 PM
Instead of the DoAction control event use a set property control event.

[ZZ_AUTH_TYPE] WIN IS_SQLSERVER_AUTHENTICATION1=1
[ZZ_AUTH_TYPE] SQL Not IS_SQLSERVER_AUTHENTICATION1=1
New Dialog NextDialogName 1


Then in XML File Changes view use [ZZ_AUTH_TYPE] to tweak the .config file.

ekramer11
07-13-2006, 11:33 AM
What I'm actually seeing in the config file is a bit odd. What it seems like is happening... is that the custom actions are firing but writing the default value for ZZ_CONNECTION_STRING into the file. It's like the conditional isn't ever firing.

It's now set up as:

Event: [ZZ_AUTH_TYPE]
Argument: WIN
Condition: IS_SQLSERVER_AUTHENTICATION1=1

Then I have two custom actions( I'll just list one ). The idea is to set ZZ_CONNECTION_STRING to a specific string if ZZ_AUTH_TYPE is a specific value.

PropertyName: ZZ_CONNECTION_STRING
PropertyValue: Data Source=Eric
Install Exec Sequence: After InstallFiles
Install Exec Condition: ZZ_AUTH_TYPE=WIN

Then in the Xml config view I have the file and the proper element in place.

Attribute: connectionString
Value: [ZZ_CONNECTION_STRING]
Operation: Create Attribute
Scheduling: Install


I'm also getting some odd XML extras that are causing .Net to freak out but I'll go into that later.

Any ideas?

Christopher Painter
07-13-2006, 12:21 PM
ControlEvents have an execution order. Is the DoAction below the [PROPERTY] Actions?

If you can't get the XML changes to work you might have to write a CA using MS XMLDOM to do it.

Also if the XML files are identical other then these two changes you could also make 2 components with mutually exclusive conditions that install differnt versions of the file depending on the property set in the dialog.

ekramer11
07-13-2006, 02:31 PM
[QUOTE=Christopher Painter]ControlEvents have an execution order. Is the DoAction below the [PROPERTY] Actions?

No, I didn't have a DoAction in for my actions. Putting one in seems to ahve solved that part of the problem. This confuses me a little though. I put entries in the Sequences view for both of my actions. This didn't call them though. Putting them under the click events of that button does? Is that how actions are supposed to work or am I just not understanding?

ekramer11
07-13-2006, 03:14 PM
Ugg... I don't know what the heck I did but it's stopped working again.

Grr!

Christopher Painter
07-13-2006, 04:14 PM
Sorry, I meant NewDialog not DoAction. The fact that controlevents have an order is the key point.

(Sorry I'm working on several projects and working several threads at the same time.)

ekramer11
07-14-2006, 10:04 AM
Got this worked out now. Thanks for the assistance.