mochalov
Posts: 8
Joined: Tue Oct 18, 2016 2:46 pm

not working condition for the SQL-transaction

Hello.
I want to achieve the following:
1. The user can select which SQL server it to use (local or remote)
2. If local, then test whether you installed the SQL server on a PC. And, if not installed, offer to install it.
3. The user can choose to create a new database or to connect to the database.
4. If selects the "Create new", it checks whether there is no database with the specified name on the server? And if not, runs the script to create the database I write a connection string in the web.config(xml)
5. If you select "connect to database" then just write a connection string in the web.config(xml)

I tried to modify the standard SQLServerConnectionDlg. Was to add a Radio Button Group (Local server or remote) and Radio Button Group (Create database or connect to the database)

Added a transaction and the script to create the database, a trigger condition if SQLServerConnectionDlg selected "Create database". But for some reason it runs even when is selected "connect to database". This condition I have tried to add to PredefinedConnection. The result is the same.
Please explain how to implement this logic?
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: not working condition for the SQL-transaction

Hello and welcome to our forums,

When you want to condition the execution of an SQL Script or of an SQL Connection depending on an option selected for a radio button group you must use a condition like this:

Code: Select all

RADIO_PROPERTY = "radio_button_1_ value"
where the "RADIO_PROPERTY" is the property of the related radio button group and the "radio_button_1_ value" is the value of the first radio button (when selected) in the radio button group. You can check the values of your radio buttons by selecting them on "Dialogs" page and verify the "Value" field in the "Properties" right pane.

Also, please take a look on the following user guide articles which should be useful for you:
1. Test SQL Connection
2. Import and edit an XML file

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mochalov
Posts: 8
Joined: Tue Oct 18, 2016 2:46 pm

Re: not working condition for the SQL-transaction

Hello.
Thanks for the reply.
I did so, but the values of the radio buttons had no standard value.
After I removed the radio buttons and created new with default values, it works.
I think You should check this bug. I have reproduced in 6.13.0
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: not working condition for the SQL-transaction

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

Regarding the radio buttons issue, I've tested the scenario but I cannot replicate the behavior. The radio buttons controls always have a value set. If you could give us a detailed step by step test case which replicates such a behavior this will be great.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mochalov
Posts: 8
Joined: Tue Oct 18, 2016 2:46 pm

Re: not working condition for the SQL-transaction

1. Create a group of radio buttons "CreateOrConnectDatabase" in dialogue SQLServerConnectionDlg
2. The value of the first radio button set - "CreateDatabase".
The value of the second - "ConnectDatabase"
3. Create a new connection with the condition RADIOBUTTONGROUP_1_PROP_1 = "CreateDatabase".
and add to it the SQL script.
Adding a second connection with the condition RADIOBUTTONGROUP_1_PROP_1 = "ConnectDatabase".
The script does not need a second (But to be convinced of is triggered, you can add any other SQL script)

We expect:
If the value selected radio button "CreateDatabase" - runs the script from the first connection.

If the value selected radio button "ConnectDatabase" - the script is executed from the second connection.

Got:
Running is always the script. What's going about inoperable conditions for connection.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: not working condition for the SQL-transaction

I've tested the scenario, but I'm still unable to replicate the issue. Can you replicate the behavior in a new project? If you could upload a small buildable sample which replicates this issue, this will be great.

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

Return to “Common Problems”