trevrobwhite
Posts: 3
Joined: Fri Sep 11, 2020 10:59 am

XML Search for Dialog

I have built a new project in Advanced Installer upgrading an existing MSI, in the [APPDIR] I have a config file in XML format which may or may not ready exist, I'm trying to use the Search functionality to pre-populate the dialog should the values already exist.

The trouble I'm having is the layout of the XML file (which I've included a sample below), I've trying to get the ServerIP, SiteName and ProjectName and store the value in the Property, I've setup a search using the type Attribute Name and result type attribute value but it's not matching, I assume because the value is actually a child or the parent, I cannot use Index because the multiple setting values can be in any orders.

Any ideas how I can achieve this?

Thanks in advance.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=XXXXX">
      <section name="PROG.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=XXXXX" requirePermission="false"/>
    </sectionGroup>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <applicationSettings>
    <PROG.Properties.Settings>
      <setting name="ServerIP" serializeAs="String">
        <!-- IP Address of the Server Hosting the REST End Point -->
        <value>192.168.0.33</value>
      </setting>
      <setting name="SiteName" serializeAs="String">
        <!-- Customer Site Name To Be Displayed in Database -->
        <value>SITENAME VALUE</value>
      </setting>
      <setting name="ProjectName" serializeAs="String">
        <!-- Project Name To Be Displayed in Database -->
        <value>PROJECT NAME</value>
      </setting>
      <setting name="EndPointUser" serializeAs="String">
        <!-- User Protecting REST Endpoint using htaccess authentication -->
        <value>restservice</value>
      </setting>
      <setting name="EndPointPassword" serializeAs="String">
        <!-- Password for REST Endpoint Protection -->
        <value>PASSWORD</value>
      </setting>
      <setting name="RequestTimeOutsecs" serializeAs="String">
        <!-- Server Timeout Reporting to REST Service, Increase if Initial Connection is Slow -->
        <value>30</value>
      </setting>
    </PROG.Properties.Settings>
  </applicationSettings>
</configuration>

search.png
search.png (26.99 KiB) Viewed 2544 times
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: XML Search for Dialog

Hello and welcome to our forums,

Are those values added in the XML file as properties (e.g. inserted by the user through dialog controls during the first install)?

If that is the case, you could set, in the older version, those properties as "persistent" properties. For more information about this, please have a look over the "How do I make the properties in the package keep their values during Maintenance or Upgrade?" article.

If this is not the case, please let me know so I can try to assist you with your scenario (the XML search).

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
trevrobwhite
Posts: 3
Joined: Fri Sep 11, 2020 10:59 am

Re: XML Search for Dialog

Hi Catalin,
The file and values usually exist, but for a new install advanced installer populates them, so I'm trying to use XML Search to bring in the values and populate the dialog where a system is already setup and where it's not the user can specify the properties on the command line to msiexec or use the dialog.
Many thanks.
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: XML Search for Dialog

Hello,

In order to achieve what you want, the XML Search may look as it follows:

setting.png
setting.png (164.38 KiB) Viewed 2468 times
value.png
value.png (176.67 KiB) Viewed 2468 times

If your XML file is located in APPDIR, an extra step might be required here:

- please go to "Table Editor" page

- change the sequence of "AI_XmlLocator" action from "101" to "1005"

Hope this helps.


Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
trevrobwhite
Posts: 3
Joined: Fri Sep 11, 2020 10:59 am

Re: XML Search for Dialog

Perfect many thanks, I will try this out.

I wanted to ask if I want to capture multiple values can I do this in one search or do I need separate ones?

To get ServerIP & SiteName

Many thanks.
Catalin
Posts: 6598
Joined: Wed Jun 13, 2018 7:49 am

Re: XML Search for Dialog

Hello,

You are always welcome!
I wanted to ask if I want to capture multiple values can I do this in one search or do I need separate ones?
I'd suggest having a search for each element.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”