/build/static/layout/Breadcrumb_cap_w.png

Wise automation help....

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`")
dataView.Execute
Set dataRecord = dataView.Fetch
Do While Not dataRecord Is Nothing

WScript.Echo dataRecord.StringData(1)

Set dataRecord = dataView.Fetch
Loop
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....)[:'(]

Thanks.

0 Comments   [ + ] Show comments

Answers (6)

Posted by: anonymous_9363 14 years ago
Red Belt
0
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.
Posted by: AngelD 14 years ago
Red Belt
0
As similar script would look like

WSIFile = "C:\My.MSI"
Set oWFWI = CreateObject("WfWi.Document")
oWFWI.Open(WSIFile)
Set tblFile = oWFWI.WTables("File")
For Each wRow In tblFile.WRows
WScript.Echo wRow("File")
Next
Posted by: captain_planet 14 years ago
Black Belt
0
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?

Thanks....
Posted by: anonymous_9363 14 years ago
Red Belt
0
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! :)
Posted by: AngelD 14 years ago
Red Belt
0
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)
Posted by: captain_planet 14 years ago
Black Belt
0
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
Next
Set releases = Nothing
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

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:

Share

 
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