[wix-users] Conditional SQL execution

Farrukh Waheed farrukh1 at gmail.com
Wed May 3 22:42:17 PDT 2017


Correction. Attribute is  "Disabled" . For details, see
http://wixtoolset.org/documentation/manual/v3/xsd/wix/control.html

On 4 May 2017 at 10:39, Farrukh Waheed <farrukh1 at gmail.com> wrote:

> Ideally, the checkbox should be setting up some property like
> EnableControl to values "yes" or "no and rest of the controls should be
> using this property in their  Disable attribute, which takes "yes" or "no"
> to Enable or Disable controls.
>
> On 4 May 2017 at 05:56, Habib Salim <habib at hsalim.com> wrote:
>
>> <reposting as Plains Text>
>>
>> Hi,
>>
>> I have a two  questions that I hope I can address together.
>>
>> I have a custom dialog to get a capture user input for properties like
>> SERVER_NAME
>>
>> 1.      How do I conditionally execute this if checkbox evaluates to true?
>> there does not seem to be  an InstallCondition.
>> I see a Condition Element that can be used in a fragment but I don't quite
>> know how to use it.
>> 2.      Ideally, the controls below the checkbox would be greyed out or
>> invisible if checkbox is false, but that does not seem possible.
>>
>> Contents of .wxs posted below
>> ----------------------------------------------------------------------
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
>>     xmlns:util ="http://schemas.microsoft.com/wix/UtilExtension"
>> xmlns:sql ="http://schemas.microsoft.com/wix/SqlExtension"  >
>>
>>   <Fragment>
>>     <Property Id="CREATE_DB" Value="false" />
>>     <Property Id="SERVER_NAME" Value="." />
>>     <Property Id="INSTANCE_NAME" Value="REPORTING" />
>>     <Property Id="USER_NAME" Value="sa" />
>>     <Property Id="PASSWORD" Value="#" />
>>     <Property Id="DB_NAME" Value="CONTROL" />
>>     <Property Id="DEMODB_NAME" Value="DemoDB" />
>>
>>     <UI>
>>       <Dialog Id="MyCustomDlg" Width="370" Height="350" Title="Server and
>> Database Settings">
>>         <Control Id="Next" Type="PushButton" X="236" Y="300" Width="56"
>> Height="17" Default="yes" Text="!(loc.WixUINext)" />
>>         <Control Id="Back" Type="PushButton" X="180" Y="300" Width="56"
>> Height="17" Text="!(loc.WixUIBack)" />
>>         <Control Id="Cancel" Type="PushButton" X="304" Y="300" Width="56"
>> Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
>>           <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
>>         </Control>
>>
>>       <!--<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
>> Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />-->
>>
>>         <Control Id="Title"       Type="Text" X="15" Y="6" Width="200"
>> Height="15" Transparent="yes" NoPrefix="yes" Text="Pivot Views Database
>> Setup" />
>>         <Control Id="Description" Type="Text" X="25" Y="23" Width="280"
>> Height="15" Transparent="yes" NoPrefix="yes" Text="Where should we install
>> the PivotViews database?" />
>>
>>         <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
>> Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
>>         <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370"
>> Height="0" />
>>
>>         <Control Id="InstallCheckBoxLabel" Type="CheckBox" Text="Create
>> Database?:" X="15" Y="60" Width="100" Height="17"
>>                  Property="CREATE_DB" CheckBoxValue="0" Default="no" />
>>
>>
>>         <Control Id="ServerNameLabel" Type="Text" X="15" Y="80"
>> Width="100" Height="17" Text="SQL Server Name:" />
>>         <Control Id="ServerNameTextbox" Type="Edit" X="120" Y="80"
>> Width="200" Height="17"
>>                  Property="SERVER_NAME" ToolTip="Enter Server Name Here"
>> />
>>
>>         <Control Id="InstanceNameLabel" Type="Text" X="15" Y="100"
>> Width="100" Height="17" Text="Instance Name:" />
>>         <Control Id="InstanceNameTextbox" Type="Edit" X="120" Y="100"
>> Width="200" Height="17"
>>                  Property="INSTANCE_NAME" ToolTip="Enter Instance Name if
>> applicable" />
>>
>>         <Control Id="UserNameLabel" Type="Text"  X="15" Y="120"
>> Width="120" Height="17" Text="User name:"/>
>>         <Control Id="UserNameTextbox" Type="Edit" X="120" Y="120"
>> Width="200" Height="17"
>>                  Property="USER_NAME" ToolTip="User ID of sa or equivalent
>> user." />
>>
>>         <Control Id="UserPasswordLabel" Type="Text" Text="Password:"
>> X="15" Y="140" Width="100" Height="17" />
>>         <Control Id="UserPasswordTextbox" Type="Edit" X="120" Y="140"
>> Width="200" Height="17" Password="yes"
>>                  Property="PASSWORD"  ToolTip="Enter a password" />
>>
>>         <Control Id="DBNameLabel" Type="Text" Text="Database name:" X="15"
>> Y="160" Width="100" Height="17" />
>>          <Control Id="DBNameTextbox" Type="Edit" X="120" Y="160"
>> Width="200" Height="17"
>>                   Property="DB_NAME"  ToolTip="This is the name of the
>> Configuration Control database.  Change it only if you must." />
>>
>>         <Control Id="BottomLine" Type="Line" X="0" Y="280" Width="370"
>> Height="0" />
>>
>>       </Dialog>
>>     </UI>
>>   </Fragment>
>>
>>   <Fragment>
>>     <Binary Id="Install_ControlObjects"
>> SourceFile="SQLData\install_PVObjects.sql" />
>>
>>     <ComponentGroup Id="DatabaseComponentGrp" Directory="INSTALLLFOLDER">
>>       <Component Id ="cmpUser" Guid="*" KeyPath="yes">
>>         <util:User Id="utilUser" Name="[USER_NAME]" Password="[PASSWORD]"
>> />
>>       </Component>
>>
>>       <Component Id="cmpCreateDb" Guid="*" KeyPath="yes">
>>         <Condition>[CREATE_DB]</Condition>
>>         <sql:SqlDatabase Id="SqlDatabase_ControlDb"
>>                          Server="[SERVER_NAME]"
>>                          Instance ="[INSTANCE_NAME]"
>>                          Database="[DB_NAME]"
>>                          User = "utilUser"
>>                          CreateOnInstall="yes"
>>                          DropOnUninstall="no"
>>                          ContinueOnError="yes"   >
>>           <sql:SqlScript Id="cmpCreateControlObjects"
>>                          BinaryKey ="Install_ControlObjects"
>>                          ExecuteOnInstall="yes"
>>                          ContinueOnError="yes" />
>>         </sql:SqlDatabase>
>>       </Component>
>>     </ComponentGroup>
>>
>>   </Fragment>
>> </Wix>
>>
>>
>> ____________________________________________________________________
>> WiX Toolset Users Mailing List provided by FireGiant
>> http://www.firegiant.com/
>>
>
>


More information about the wix-users mailing list