Advice required on features and SQL Scripts - 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!

jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Advice required on features and SQL Scripts

What we are using at the moment uses .BAT files with internal execution of osql to install a predefined stored procedure via an sql file.
I can load my main application feature with its components.
I can load my sql files under e.g. Custom SQL Connection.
All of this works without a problem. The featuer application and library files are being installed and I am using two server connections and installing the SQL Scripts to both.

What I want to be able to do is to make the SQL Scripts installation user selectable i.e. a Feature. I could then use CustomizeDlg to select / deselect a feature called SQL Only.
This feature would not contain anything but I am assuming I could set a property that I could check for a value when it attempts to install the SQL Scripts?

Is this possible or would you recommend another way of doing it?

Regards,
John
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Advice required on features and SQL Scripts

Hi John,
This feature would not contain anything but I am assuming I could set a property that I could check for a value when it attempts to install the SQL Scripts?
You could add a condition to each of your SQL scripts. This condition can consist of a public property which is associated with a UI control( e.g. CheckBox ). This way the scripts will be executed only if the condition is true( e.g. CheckBox is enabled by the user ).
If none of the SQL scripts assigned to an SQL connection is to be executed due to their condition or scheduling, that SQL connection will not be triggered.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

As the CustomizeDlg is alredy in the format I require I don't really want to add a checkbox if I can avoid it.
If I select or deselect a feature using this dialog does this set or reset a public property? It uses a Selection Tree with a proprty named _BrowseProperty.
Sorry if this is basic stuff I am new to this and doing an evaluation.

Thanks,
John
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Advice required on features and SQL Scripts

Hi John,

Thank you for taking the time to evaluate Advanced Installer.

If you want to condition the script execution if a feature will be installed or not, you can try the following condition for your SQL scripts:

Code: Select all

&YourFeatureName=INSTALLSTATE_LOCAL
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

The problem with this is that I am running on Windows 7 which I am assuming is using Windows Installer V5.X.

In the CustomizeDlg there is a Selection Tree. At first I thought this was my problem and changed it to a Quick Selection Tree from the toolbox. This seemed to be the answer to my problem however I was running on Windows Sever 2003 and presumably an earlier version of Windows Installer (how do I check version easily?). So on Windows 7 on the feature icons there is a dropdown list that gives you the following options: -

Will be installed on local hard drive
Entire feature will be installed on local hard drive
Will be installed or run from network
Feature will be installed when required
Entire feature will be unavailable

Teh top two and the last one seem to do what I want. However, if the user selects network or when required it obviously does not work. Is there any way of getting rid of these options? What exactly do they mean?

Regards, John
BTW - I have bought the enterprise edition of the tool with 6 months support so I would really like to get it working :D
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

As an update to this it was on XP SP3 operating system.
When the .msi was executed on this system the third option in the list "network" was not shown.

So, I guess the question is what is the INSTALLSTATE when this option is selected? If I know this I could probably then create a condition as you have suggested to incorporate this.

Thanks,
John
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Advice required on features and SQL Scripts

Hi John,

Here's each option's meaning:
"Will be installed on local hard drive" => INSTALLSTATE_LOCAL (3) - Feature or component is on the local computer.
"Will be installed or run from network" => INSTALLSTATE_SOURCE (4) - Feature or component will run from the source.
"Feature will be installed when required" => NSTALLSTATE_ADVERTISED (1) - Advertised feature. This state is not available for components.
"Entire feature will be unavailable" => INSTALLSTATE_ABSENT (2) - Feature or component is not present.

You can use the above in your sql condition.

Also, if you don't need all the dropdown options you can easily follow this article:
http://www.advancedinstaller.com/user-g ... ature.html

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

Is there an article describing waht the & and ! mean in the conditions. I understand logical and bitwaise operations but these seem to be used differently as in: -

((&YourFeature = 3) and NOT (!YourFeature = 3))
Thanks,
John
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

What I want to do is use the published events and conditions on a dialogue like this: -

If AI_INSTALL AND (&YourFeature = INSTALLSTATE_ABSENT) Then GOTO Dialog ABCDlg
else
Set up connection string AI_INSTALL AND (&YourFeature <> INSTALLSTATE_ABSENT)
TestODBCConnection AI_INSTALL AND (&YourFeature <> INSTALLSTATE_ABSENT)
GOTO Dialog ABCDlg where return from connection = 1 AI_INSTALL AND (&YourFeature <> INSTALLSTATE_ABSENT) ' Same Dialog as above only after test ODBC.
end if

It always does the test ODBC Connection even though I have deselected the feature. YourFeature.

can this be resolved?

Regards,
John
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

As shown in the attached file
Attachments
PrimaryConnection.JPG
PrimaryConnection.JPG (233.15 KiB) Viewed 12873 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Advice required on features and SQL Scripts

Hi John,
Is there an article describing waht the & and ! mean in the conditions.
Yes, here it is.
It always does the test ODBC Connection even though I have deselected the feature. YourFeature.
I'm not sure why this is happening, but you can track the feature action in your log file( "Run and Log" ).

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

Thanks for pointing me at the manual page. I am trying to read it as well as develop a fundamental project. Not happening at the moment :D :D :D
jusher
Posts: 195
Joined: Thu Dec 22, 2011 12:00 pm

Re: Advice required on features and SQL Scripts

As you can see from teh following log when I select a feature the property changes state from 2=>3 and back: -
MSI (c) (10:60) [19:12:34:753]: PROPERTY CHANGE: Adding MsiSelectionTreeSelectedFeature property. Its value is 'MainApplicationFeature'.
MSI (c) (10:60) [19:12:34:768]: PROPERTY CHANGE: Adding MsiSelectionTreeSelectedAction property. Its value is '2'.
MSI (c) (10:60) [19:12:34:768]: PROPERTY CHANGE: Adding MsiSelectionTreeSelectedCost property. Its value is '0'.
Action 19:12:34: BTSCustomizeDlg_0. Dialog created
MSI (c) (10:60) [19:12:54:066]: Note: 1: 2727 2:
MSI (c) (10:60) [19:12:54:066]: PROPERTY CHANGE: Modifying MsiSelectionTreeSelectedAction property. Its current value is '2'. Its new value: '3'.
MSI (c) (10:60) [19:12:54:082]: PROPERTY CHANGE: Modifying MsiSelectionTreeSelectedCost property. Its current value is '0'. Its new value: '8855'.
MSI (c) (10:60) [19:12:54:082]: PROPERTY CHANGE: Adding MsiSelectionTreeSelectedPath property. Its value is 'C:\Program Files\CommsWare\SAW\'.
MSI (c) (10:60) [19:13:01:144]: Note: 1: 2727 2:
MSI (c) (10:60) [19:13:01:160]: PROPERTY CHANGE: Modifying MsiSelectionTreeSelectedAction property. Its current value is '3'. Its new value: '2'.
MSI (c) (10:60) [19:13:01:160]: PROPERTY CHANGE: Modifying MsiSelectionTreeSelectedCost property. Its current value is '8855'. Its new value: '0'.
MSI (c) (10:60) [19:13:01:160]: PROPERTY CHANGE: Deleting MsiSelectionTreeSelectedPath property. Its current value is 'C:\Program Files\CommsWare\SAW\'.

Using identifiers: -
SQLINSTALLATION and MainProgramFeature

I want to have a DoAction event that says that you must select a feature before proceeeding. I have creted scriptinline with a messageboc for this.
My test in a DoAction event off the next button is this: -
AI_INSTALL AND ((&SQLINSTALLATION = 2) AND (&MainApplicationFeature = 2))

Can you see anything wrong with this?

I have an event following the doAction which goes to the next dialog, it always goes to the next dialogue without displaying the messagebox.

Regards,
John
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Advice required on features and SQL Scripts

Hi John,

You can try:

Code: Select all

NOT ((&SQLINSTALLATION = 3) OR (&MainApplicationFeature = 3))
instead of:
(&SQLINSTALLATION = 2) AND (&MainApplicationFeature = 2)
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”