Scripting Question

Wise automation help....

06/15/2010 3149 views
Ahh drat. I'm struggling with this Wise Automation API. Using Windows Installer automation we can create something like the following, using a custom SQL command:

Set dataView = oDatabase.OpenView("SELECT `File` FROM `File`")
Set dataRecord = dataView.Fetch
Do While Not dataRecord Is Nothing

WScript.Echo dataRecord.StringData(1)

Set dataRecord = dataView.Fetch
Set dataView = Nothing
Set dataRecord = Nothing
Is it possible to perform a similar kind of logic using the Wise Automation object? I've read through WiseAutomation.chm but it's not helping....(or maybe i'm just being thick today....)[:'(]

0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

In the absence of proper documentation, I normally start the VBA editor in, say, Outlook (or any Office app) then create a reference to the COM object. Then I can browse the object's properties and methods (hit F2) and try out some code. The neat thing about using the VBA editor is that you have AutoComplete for the objects.
Answered 06/15/2010 by: anonymous_9363
Red Belt

As similar script would look like

WSIFile = "C:\My.MSI"
Set oWFWI = CreateObject("WfWi.Document")
Set tblFile = oWFWI.WTables("File")
For Each wRow In tblFile.WRows
WScript.Echo wRow("File")
Answered 06/15/2010 by: AngelD
Red Belt

Nice tip there, VBScab. Never really used that approach before....I'd still prefer even half-decent documentation though. [;)]

AngelD - Thanks for that code. It'll do the job that I want, although not quite as efficient as I'd like. I guess in my original post I should have slammed a 'WHERE' clause in that SQL statement. I'm actually trying to delete entries based on, say, the name of the file.

Is there any way to use a 'where' clause, as opposed to looping through every file and using an 'If' statement?

Answered 06/16/2010 by: captain_planet
Black Belt

I don't believe the object model works like that. Besides, even if that functionality were available, I'm not altogether sure it would be any more efficient, since the files have to be enumerated at some point by either mechanism. Of course, on an actual SQL database, the query engine would optimise the query as far as possible but that's not what we're dealing with here. What we have in WI is what I call "SQLesque" and is a L O N G way from being optimised for queries! :)

Have you posted on Symantec's Connect 'Wise Application Packaging' forum? One of the moderators, EdT, has done a lot of work with Wise automation. Well, more than most of us, anyway! :)
Answered 06/16/2010 by: anonymous_9363
Red Belt

Something like this?
bSmartDelete = false '// set to true if you want to remove related table entries associated with the primaryKey, useful for removal ex. components
primaryKey = "TableEntryIdentifierToRemove" '// where more then one identifier exist separate them with a comma ex. for the FeatureComponents table: "Feature1,Component1"
Call tblFile.WRows.DeleteKeyRow(primaryKey, bSmartDelete)
Answered 06/16/2010 by: AngelD
Red Belt

Thanks, guys. I actually used the delete method in the end, to delete the relevant component and all it's related entries in the other tables:

tempComponent = *logic to get a specific component i wish to delete*
Set releases = WFWI.WTables("Component").WRows
For Each row in releases
If row("Component") = tempComponent Then
releases.Delete row, True 'true should cascade deletion
Exit For
End If
Set releases = Nothing
Answered 06/17/2010 by: captain_planet
Black Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ