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

Comments

Please log in to comment

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

Answers

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.
Answered 06/15/2010 by: VBScab
Red Belt

Please log in to comment
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
Answered 06/15/2010 by: AngelD
Red Belt

Please log in to comment
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....
Answered 06/16/2010 by: captain_planet
Second Degree Brown Belt

Please log in to comment
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! :)
Answered 06/16/2010 by: VBScab
Red Belt

Please log in to comment
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)
Answered 06/16/2010 by: AngelD
Red Belt

Please log in to comment
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
Answered 06/17/2010 by: captain_planet
Second Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity