This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Read data from file
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 15, 2008
11:17 AM
Read data from file
Hi
We are trying to implement upgrades on our installers but we have a config file that is updated in each upgrade and it contains the connection string the user uses.
We need a way to read the data source from the connection string so that the update can copy the new config file and then the data source can be copied back into the new config file.
I can do filegrep to get the full line but I only need the value after data source, if there a way to do this with InstallScript?
Thanks in advance,
Rich
We are trying to implement upgrades on our installers but we have a config file that is updated in each upgrade and it contains the connection string the user uses.
We need a way to read the data source from the connection string so that the update can copy the new config file and then the data source can be copied back into the new config file.
I can do filegrep to get the full line but I only need the value after data source, if there a way to do this with InstallScript?
Thanks in advance,
Rich
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 22, 2008
09:02 AM
No one?
Thanks,
Rich
Thanks,
Rich
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 22, 2008
09:05 AM
What kind of project? What format is your config file? If it's an MSI project and an XML file, perhaps you can use a system search to get the XML data, as in the "Reading XML Data with a System Search" tip on the Tips & Tricks page (PDF warning): http://www.acresso.com/products/installation/installshield.htm?tabContent=/products/installation/installshield/res_4744.htm.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 22, 2008
09:14 AM
It is an InstallScript MSI project, the contents of the file is:
I want to search on that file for the "data source=" part and store the "localhost\sqlexpress" part in InstallShield to be used to insert into the new config file.
Thanks,
Rich
I want to search on that file for the "data source=" part and store the "localhost\sqlexpress" part in InstallShield to be used to insert into the new config file.
Thanks,
Rich
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 22, 2008
10:16 AM
One approach might be to read the whole "value" string from the XML file as in that tip; read the property value into a string with MsiGetProperty; break it apart at semicolons using StrGetTokens; then break it again at the equal sign...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
04:47 AM
I have done that but all I get is a null return.
Even if I try the example I get a null. If I do an install with "setup.exe /V"/L*v C:\everything.log"" (found in a post by you!) then I get the value for the example one but not mine (which leads me to the fact mine is setup wrong).
In the log it has the value changing for the example one (VALUE_FROM_XML_FILE) but does not have my one changing, the only line in the log file for mine is:
"AppSearch: Property: VALUE_FROM_CONFIG_FILE, Signature: NewSignature11"
This does not explain why it does not work on an upgrade, the purpose is for it to run on an upgrade and not on a normal install, is this not possible? If so, any other way to read the contents of an xml on an upgrade?
Thanks,
Rich
p.s. What would be the correct XPath value for my config file? I have /appsettings[@add='Main.ConnectionString'] returning "value" but that does not work.
Even if I try the example I get a null. If I do an install with "setup.exe /V"/L*v C:\everything.log"" (found in a post by you!) then I get the value for the example one but not mine (which leads me to the fact mine is setup wrong).
In the log it has the value changing for the example one (VALUE_FROM_XML_FILE) but does not have my one changing, the only line in the log file for mine is:
"AppSearch: Property: VALUE_FROM_CONFIG_FILE, Signature: NewSignature11"
This does not explain why it does not work on an upgrade, the purpose is for it to run on an upgrade and not on a normal install, is this not possible? If so, any other way to read the contents of an xml on an upgrade?
Thanks,
Rich
p.s. What would be the correct XPath value for my config file? I have /appsettings[@add='Main.ConnectionString'] returning "value" but that does not work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 26, 2008
11:40 AM
RICOUK wrote:That XPath query refers to an appsettings element with an attribute named add with attribute value 'Main.ConnectionString'. What you probably want is /appsettings/add[@key='Main.ConnectionString'], which refers to an add element (under an appsettings element) with a key attribute as specified.
p.s. What would be the correct XPath value for my config file? I have /appsettings[@add='Main.ConnectionString'] returning "value" but that does not work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 27, 2008
02:22 PM
Thanks, but it doesn't run on an upgrade so it is pretty useless to us as we don't need it on a fresh install (as the file won't be there) is there a way to make it run on an upgrade, or write my own function that does essentially the same thing?
Someone has to have done this before, I can't see how it isn't a built in function as it seems a fairly obvious thing to me for an upgrade to do.
Thanks,
Rich
Someone has to have done this before, I can't see how it isn't a built in function as it seems a fairly obvious thing to me for an upgrade to do.
Thanks,
Rich
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 27, 2008
04:15 PM
I believe XML changes are tied to component state changes, so what you need is to create and/or condition a component such that it will only install in the upgrade scenario. Depending on whether you mean a minor or a major upgrade, the exact approach could be rather different.
You could of course take this from a custom action approach, at which point you'll have to write similar conditions (and the whole XML update itself), but not worry about making a component only install in those certain scenarios.
You could of course take this from a custom action approach, at which point you'll have to write similar conditions (and the whole XML update itself), but not worry about making a component only install in those certain scenarios.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)