[wix-users] Iteration - Can it be done dynamically depending on a runtime variable

Phill Hogland phill.hogland at rimage.com
Tue Mar 15 05:52:21 PDT 2016


I also have not used the Preprocessor syntax, which is a build time event, but if you need dynamic behavior at runtime I would look into creating a semi-custom action which adds the desired entries to the corresponding MSI tables at run time.  Here is a good blog (but dated and the example code may have changed):
http://www.joyofsetup.com/2007/07/01/semi-custom-actions/

I found it helpful to search the wix src and review the many examples of using WcaAddTempRecord in various WixExtensions.

________________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Farrukh Waheed <farrukh1 at gmail.com>
Sent: Tuesday, March 15, 2016 7:41 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Iteration - Can it be done dynamically depending on a runtime variable

I haven't used Sql queries like this.  <?forEach.. > is a Preprocessor
thing, and so it would be evaluated before compiling things started.

So I guess, you may have to use SQL script which should execute in
iterative way during installation i.e. Sql query script should be using
similar to <?foreach DynamicDB......  thing....

Hope you got my point.

On 15 March 2016 at 15:32, Venkatesan, Ravikumar <
Ravikumar.Venkatesan at scientificgames.com> wrote:

> Hi All,
>
>                 I use the below code to iterate the execution of an SQL
> script file on a list of DBs that’s declared using “<?define?>” statement.
> Everything is fine with the below. However, what I really want is to use a
> dynamic list that shall be known only during the runtime instead of
> hardcoding it like this. Is there a way to do this?!
>
>
>     <?define DynamicDBList="FinalStaging;FinalStaging2;FinalStaging3"?>
>
>     <?foreach DynamicDB in $(var.DynamicDBList)?>
>       <sql:SqlDatabase Id='Dynamic_SQLDB.$(var.DynamicDB)'
> Database='$(var.DynamicDB)' User='SQLUser_local_ETL'
> Server='[DATABASE_SERVER]'/>
>     <?endforeach?>
>
>                                   <Fragment Id='ThisMustWork2'>
>     <ComponentGroup Id='cmpg_ThisMustWork2' Directory='INSTALLFOLDER'>
>       <Component Id='cmp_ThisMustWork2'
> Guid='CA2C7BB6-2D71-486D-9355-884CFA7ADF3D' KeyPath='yes'>
>         <?foreach DynamicDB in $(var.DynamicDBList)?>
>           <sql:SqlScript Id='ss.$(var.DynamicDB)'
> BinaryKey='bi_TestScript' ExecuteOnInstall='yes'
> SqlDb='Dynamic_SQLDB.$(var.DynamicDB)' Sequence='1'/>
>         <?endforeach?>
>       </Component>
>     </ComponentGroup>
>   </Fragment>
>
>
> Regards,
> Ravy
>
>
> Ravikumar Venkatesan | Lead Analyst | Bally Technologies India Private
> Limited<http://www.ballytech.com>   | (M) +91 98 8436 0607
>
> May be privileged. May be confidential. Please delete if not the addressee.
> Venkatesan Venkatesan
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list