Hi Guys,

I am trying to build a ICE for msi validation.

But do not found how to format the code for display output informations in issue pane orca :

This the script :

'Internal Consistency Evaluators : Checks for empty Components in Component Table
Function egICE02()
'On Error Resume Next Set recInfo=Installer.CreateRecord(1)
If Err <> 0 Then
egICE02 = 1
Exit Function
End If
'Give creation data
Set recInfo=Installer.CreateRecord(1)
recInfo.StringData(0)="egICE02" & Chr(9) & "3" & Chr(9) & "Created 08/08/2013 "
Message &h03000000, recInfo 'Give last modification date
recInfo.StringData(0)="egICE02" & Chr(9) & "3" & Chr(9) & "Modified 09/08/2013 "
Message &h03000000, recInfo 'Give description of test
recInfo.StringData(0)="egICE02" & Chr(9) & "3" & Chr(9) & "egICE02 : Checks for empty Components in Component Table"
Message &h03000000, recInfo 'Is there a Component table in the database?
iStat = Database.TablePersistent("Component")
If 1 <> iStat Then
recInfo.StringData(0)="egICE02" & Chr(9) & "1" & Chr(9) & "Table: 'Component' missing. egICE02 cannot continue its validation." & Chr(9) & "http:// "
Message &h03000000, recInfo
egICE02 = 1
Exit Function
End If 'define object
Dim allcomponentsView, rec, tableView, tableRec, componentsView, componentRec
Dim emptyComponent : emptyComponent = True
Dim tempComponent : tempComponent = "" 'perform a view of component table

Set allcomponentsView = Database.OpenView("Select `Component` From `Component` ORDER BY `Component`")
allcomponentsView.Execute
Set allcomponentsRec = allcomponentsView.Fetch


Do While Not allcomponentsRec is Nothing tempComponent = allcomponentsRec.StringData(1) 'list the tables that have 'Component_' (foreign key) columns without table FeatureComponents and CreateFolder(because containt all components)
Set tableView = Database.OpenView("SELECT `Table` FROM `_Columns` WHERE `Name`= 'Component_' AND `Table` <> 'FeatureComponents' AND `Table` <> 'CreateFolder' AND `Table` <> 'ISComponentExtended' AND `Table` <> 'RemoveFile'")
tableView.Execute
Set tableRec = tableView.Fetch
Do While Not tableRec is Nothing
'recInfo.StringData(0)="egICE02" & Chr(9) & "3" & Chr(9) & " Table : " & tableRec.StringData(1) & " Component : " & tempComponent
'Message &h03000000, recInfo
emptyComponent = True
Set componentsView = Database.OpenView("SELECT `Component_` FROM `" & tableRec.StringData(1) & "` WHERE `Component_`='" & tempComponent & "'")
componentsView.Execute
set componentRec = componentsView.Fetch
If Not componentRec is Nothing Then 'this table has a some data belonging to some component
'recInfo.StringData(0)="egICE02" & Chr(9) & "3" & Chr(9) & " component contains data : " & componentRec.StringData(1)
'Message &h03000000, recInfo
'component contains data
emptyComponent = False
'skip component and move to next
Exit Do
End If Set tableRec = tableView.Fetch
Loop If emptyComponent Then
recInfo.StringData(0)="egICE02" & Chr(9) & "2" & Chr(9) & " Empty Component: [1] is " & Chr(9) & "" & Chr(9) & "Component" & Chr(9) & "[1]"
Message &h03000000, recInfo
End If

Set allcomponentsRec = allcomponentsView.Fetch
Loop 'Return
egICE02 = 1
Exit Function
End Function

This display , what i want but not in the pane :

If emptyComponent Then
recInfo.StringData(0)="egICE02" & Chr(9) & "2" & Chr(9) & " Empty Component: "& tempComponent
Message &h03000000, recInfo
End If

 

 And this is the lines of script , i would like manage properly :

If emptyComponent Then
recInfo.StringData(0)="egICE02" & Chr(9) & "2" & Chr(9) & " Empty Component: [1] is " & Chr(9) & "" & Chr(9) & "Component" & Chr(9) & "[1]"
Message &h03000000, recInfo
End If

Have you got any advices to format the display?

Thanks

 

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1

...it should probably be something like:

If emptyComponent Then
      allcomponentsRec.StringData(0)="egICE02" & Chr(9) & "2" & Chr(9) & " Empty Component: [1] is " & Chr(9) & "" & Chr(9) & "Component" & Chr(9) & "[1]"
Session.Message &h03000000, allcomponentsRec
End If

You should take a look at my CubMakr tool here too: http://www.alkanesolutions.co.uk/content/cubmakr.aspx

It's a free tool that takes all this coding element away from it.  Having said that, things like detecting empty components would need to be added to the master cub template really.  You'll see what I mean.  The only reason you have to register is because it enables you to store cub file rules online, and update them on the fly.  I'll release a video tutorial when I get a second.  Let me know what you think....

Answered 08/12/2013 by: captain_planet
Second Degree Brown Belt

  • Thanks ! yes , it is a good stuff you did , a tuto will be useful to perform some cub files with it.
Please log in to comment
Answer this question or Comment on this question for clarity