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:
Thanks.
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)
Please log in to answer
Posted by:
anonymous_9363
14 years ago
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
Posted by:
captain_planet
14 years ago
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....
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
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! :)
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
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)
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
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.
so that the conversation will remain readable.