PDA

View Full Version : XML File Change



Sanchivan
03-31-2006, 01:40 PM
Hi,

I am creating a 'Basic MSI Project' Using InstallShield 11 to create a package for one of the project. I have figured out how to actually edit the XML when a user enters something into a text box. There are three different environment where this program needs to be installed: Development, Test and Production. So when a user selects Development I want to change the web.config file's 'DB Server' to 'DEVDB'. I tried to do this. I have a dialog with radio button group and the property name is ENVIRONMENT. when I install this, it puts 1 for devepment, 2 for test, and 3 for production. Well, this is the value that is for each radio button, I tried to change the value to DEVDB and so on. But that does not work. It doesn't let me change it. I cant seen to figure this out. Could somebody help me with this please. thank you.

Sanchivan

Sanchivan
04-04-2006, 01:36 PM
Hi guys,

Could someone out there give me some help with this. Thanks.

jjchase
04-04-2006, 03:28 PM
Easy way is to Set a Variable according to what your radio button is through a custom action. Make sure the variable is PUBLIC - so in all CAPS. Then in your XML File Change - go to the part of the XML section that you want changed and put in [YOURVARIABLENAMEHERE] and it will replace [] with the value of your PUBLIC variable.

Sanchivan
04-04-2006, 04:11 PM
Hi jjchase,

I am not quite understanding what you mean. I am a Newbie to InstallShield, so I am really sorry if that sounds really dumb :) I really don't know how to create a custom action. What I have so far is a radio button group with property name [ENVIRONMENT] and within that group I have three radio button (Development, Test, Production).
Also, in the XML File Changes View I have set the Value of the attribute that I am trying to set equal "[ENVIRONMENT]" (without the quote). What this does is just puts 0, 1 or 2 depending on what I select in the radio button group. This is not what I want. If the user selects Development,I don't want to put "0", I want to put "DEVDB". How can I archieve this?

Sanchivan S.

jjchase
04-04-2006, 06:01 PM
To Create a Custom Action - it is under the Behavior and Logic - then under the custom action view. Right click - Create Custom Action Wizard. Put in a name of your Custom Action that you want to call. Next select of how you want to create your custom action in ... vbscript ... install script ... etc. I personally like vbscript coming from a vb background - others prefer install script. I typically store the code within the Custom Action. Then the next screen is where you put in your VBCode. What I would recommend is create another property in property manager - call it whatever you want but all in CAPS - this will make it PUBLIC to access anywhere i.e. - INSTALLTYPE.

Then in your custom action

IF Session.Property("ENVIRONMENT") = 0 THEN
INSTALLTYPE = "DEVDB"
ELSEIF Session.Property("ENVIRONMENT") = 1 THEN
INSTALLTYPE = "DB2"
ELSEIF Session.Property("ENVIRONMENT") = 2 then
INSTALLTYPE = "DB3"
END IF

You will then need to link this Custom Action to a Dialog - I would recomment right when the user hits the NEXT button - so go to that behavior and then for action hit DO ACTION - then select your custom action code and then a 1 for it to always fire off when the user hits the Next Button.


Then in your XML File view - instead of using ENVIRONMENT - you would put in INSTALLTYPE.

So now when you run instead of 0,1,2 you will now have DEVDB, DB2, DB3

Sanchivan
04-05-2006, 09:35 AM
Hi jjchase,

Thank you so much for your reply. I did what you have told me. It seems straight forward, but now it doesn't install the package. I am not sure if I need to set anything in the Install UI Sequence, Install Exec Sequence, Advertise Exec Sequence, Admin UI Sequence and Admin Exec Sequence. These are Common properties of the Custom Actions. I left it as Absent from sequence. This doesn't work. I tried playing around with this sequence, but I dont' seem to get anywhere. Could you please help me. Thanks.

Sanchivan
04-05-2006, 10:44 AM
Hello, could someone help me please. Thanks.

jjchase
04-05-2006, 11:05 AM
What exactly is occurring in your install package ? What does it say in the log file ? Do you have a syntax error somewhere ?

Sanchivan
04-05-2006, 11:18 AM
When I start up the install package, and select Development from the Environment Window and click next, it just skips the other dialog's that I have after the Environment Dialog which is called "Shared Settings" and etc to the "InstallShield Wizard Completed". So IT doesn't even install anything and it doesn't give me an error message. And when you say log file, you mean the log file that get's generated when you build the package rite? Far as I know that's the only log file I know about. If there is a log file that is created when I am actually running the installation package, then I don't know about that. But in the Log file that is created when I build the package, there are no errors.

Sanchivan
04-05-2006, 01:30 PM
Hi jjchase,

I recreated the custom action. Now it installs, but inthe xml it puts a value of "0". I dont' thinkt he Custom Action is even being executed. The value "0" is the value that is given in the Property Manager for the Property INSTALLTYPE. I know this is what it's writing because I changed this "0" to "test" and that is what was writen to the xml file. So I am not sure what I am doing wrong here. Could you please help me please. Thanks.

Sanchivan
04-05-2006, 03:53 PM
Please HELP :(

Sanchivan
04-06-2006, 08:48 AM
Hi,

I am still trying to figure this out. I am going to summarize what I did so far. Please tell me what I am doing wrong or what I didn't do.

I created a Custom Action called "DBServer" and created a VB Script for it as follows:
IF Session.Property("ENVIRONMENT") = 1 THEN
INSTALLTYPE = "DEVDB"
ELSEIF Session.Property("ENVIRONMENT") = 2 THEN
INSTALLTYPE = "QADB"
ELSEIF Session.Property("ENVIRONMENT") = 3 THEN
INSTALLTYPE = "PRODDB"
END IF

In the Attachment you can see the "Common" Properties for this "DBServer" custon action.

After this, I have created a Property name "INSTALLTYPE" in the Property Manager and given a value of "0".

Then in the Dialogs View for the dialog named Environment (This is where I have the three radio buttons: Development, Test, Production), I have added the Event "DoAction" and for that I have added the custom action "DBServer" with Condition "1" when the user clicks the Next button. This is shown in the attachment as well.

Also I have added the [INSTALLTYPE] property as the value in the XML File Changes View as well.

So what is it that I am doing wrong? Do I need to add this action in the Sequence View? I tried that by inserting the action to be after the InstallWelcome Dialog under the Installation section, that did not work. Also I tried adding the action into the Execute sequence as well, that did not work as well. So I am not really sure what I am doing wrong. Please help me. Thanks to everyone who tried to help me.

RobertDickau
04-06-2006, 09:11 AM
In that code, INSTALLTYPE is a VBScript variable but not a property; if you want to use , you'll need to create the property with something like:

Session.Property("INSTALLTYPE") = "DEVDB" ' [i]and so on

RobertDickau
04-06-2006, 09:30 AM
P.S. Of course it would be easier to make the radio button values "DEVDB", "QADB", and "PRODDB", but you mentioned that didn't work; in what way didn't it work?

Sanchivan
04-06-2006, 09:43 AM
Hey RobertDickau

Thank you sooooooo much. I been trying to fugure this out for a while. Also, I coudn't change the Value of the radio button to DEVDB, QADB and so on from the values 1, 2, 3. This is because when I change the value of the radio button "Development" from 1 to DEVDB and click on the Radio button Test and Click back on the Radio button "Development" it switches back the value of "Development" to "1". I think the radio button's value's cannot be changed. I am not too sure about this. If there is a way to change this value, that is seriously much easier than what I am trying to do. But in any case, I learned how to use the custom action. But if you know how to change the values of the radio button please do tell me. You can see on the attachedment the settings of the radio button. Thank you so much for your help. I really appreciae it :).

Sanchivan S.

RobertDickau
04-06-2006, 01:05 PM
Hmmm... If you can't edit the radio button values in the Dialog Editor, perhaps open the RadioButton table in the Direct Editor view and try to edit the values there?