Corey
Posts: 13
Joined: Tue Mar 25, 2014 4:54 am

Set default XML element when assigned variable is empty

Hi All,
I am trying to configure an XML config file during install, I have imported the file and made most of the changes necessary. I am running into a problem with default values and feature selection.

In the XML we have a line which will look like this unconfigured

<PostURL/>

and like this when configured

<PostURL>http://someplace.com/path</PostURL>


This is configured via a Radio button group with Yes / No and if yes is selected the edit field becomes enabled. I want to be able to have a default value supplied here if Yes is selected and no value if No is selected.

Is there a way to do this?

Thanks
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Set default XML element when assigned variable is empty

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can use our "Edit XML file" support. For example, you can proceed like this:
- go to "Install Parameters" page and add a property like this:
  • Name: XML_PROP
    Value: Default value
- go to "Files and Folders" page and open the XML file in edit mode (using "Properties..." context menu option)
- select the "PostURL" element and in the "Text" section add the "XML_PROP" like this:

Code: Select all

[XML_PROP]
- go to "Dialogs" page, select the dialog where resides your radio button group control (e.g. RADIO_PROP) and on the [Next>] button add the following published events:
  • Control Event: Set installer property value
    Property: [XML_PROP]
    Argument: {}
    Condition: RADIO_PROP = "no"

    Control Event: Set installer property value
    Property: [XML_PROP]
    Argument: default value
    Condition: RADIO_PROP = "yes"
- build and run your project

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Corey
Posts: 13
Joined: Tue Mar 25, 2014 4:54 am

Re: Set default XML element when assigned variable is empty

Hi Daniel,
This is close thanks. the only issue is it wont pick up the new value if I change it. I have tried inputting this


Published event on the next button

Property [POSTURL]
Argument [EDIT_1_PROP]
Condition RADIOBUTTONGROUP_1_PROP_1 = "Yes" AND RADIOBUTTONGROUP_2_PROP = "Yes"

this doesn't transform the property of [POSTURL] to what was entered into [EDIT_1_PROP] which is what I am trying to achieve. Thanks again for your help

Edit:

This does actually work quite well if you spell your installer property correctly
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Set default XML element when assigned variable is empty

You're welcome. I'm glad you got this working.

If you have any questions let us know.

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

Return to “Common Problems”