Problem with Scripts and checkbox - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

dlac
Posts: 2
Joined: Mon Jul 30, 2012 7:20 pm

Problem with Scripts and checkbox

Hi!
I can't seem to make the following scenario to work:
I want the user to choose if he wants to install the database with a checkbox.
so...
I have a property called CREATEDB with value 1
in a dialog i have a checkbox with property name set to CREATEDB, value set to 0 and default value set to 1
in the dialog next button i have the published events:

Code: Select all

EVENT           |    Argument                 |  Condition
NewDialog          VerifyReadyDialog                 AI_INSTALL
[CREATEDB]            {}                            AI_INSTALL AND (NOT CHECKED) 
[CREATEDB]             1                           AI_INSTALL AND (CHECKED) 
In SQL Scripts I have the script condition set to CREATEDB = "1"
and In case of error go to next script of the connection.

the problem is that the checkbox doesn't assume both values {} and 1
and the script condition doens't recognize the CREATEDB value as = "1"

what am I doing wrong?

thanks in advance.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with Scripts and checkbox

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you should follow our "Use a property in a SQL script" article steps.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dlac
Posts: 2
Joined: Mon Jul 30, 2012 7:20 pm

Re: Problem with Scripts and checkbox

So SQL Scripts can't use installer properties (CREATEBD in my case)?
also, why the checkbox doesn't change the property value?
here's the log:

Code: Select all

MSI (c) (08:C0) [10:51:53:565]: PROPERTY CHANGE: Deleting CREATEDB property. Its current value is 'checked'.
MSI (c) (08:C0) [10:51:54:243]: PROPERTY CHANGE: Adding CREATEDB property. Its value is 'checked'.
MSI (c) (08:C0) [10:51:54:881]: PROPERTY CHANGE: Deleting CREATEDB property. Its current value is 'checked'.
MSI (c) (08:C0) [10:51:55:261]: PROPERTY CHANGE: Adding CREATEDB property. Its value is 'checked'.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with Scripts and checkbox

Hello,
So SQL Scripts can't use installer properties (CREATEBD in my case)?
Yes, you're right. As is described in the related article SQL scripts cannot contain installer properties. You should use our SQL Script Replacement Dialog feature in order to achieve what you want.
also, why the checkbox doesn't change the property value?
Please keep in mind that when a check box is checked, then the check box's property is set to the value specified in the "Value" field from "Properties" right pane. Also, when the check box is unchecked the related property is empty.

In order to achieve what you want you can proceed as follows:
- Go to "Dialogs" page and add a check box control like this:
  • Property Name: CREATEDB
    Value: 1
- Edit your SQL script using a custom identifier (i.e. $CreateDB$) which will be replaced by the check box's property.
- Go to "SQL Scripts" page, select your SQL script and add the following SQL script replacement:
  • Find What: $CreateDB$
    Replace with: [CREATEDB]

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

Return to “Common Problems”