Friday, July 25, 2008

script to get the duct info blob

'getting the value from Blob field
Dim pBlob As IMemoryBlobStream
iCount = iCount + 1
If IsNull(pfeat.Value(nBlob)) Then
GoTo myEnd
End If
Set pBlob = pfeat.Value(nBlob)

'create the duckbankconfig and ductview objecs
Dim pDuctBankConfig As IMMDuctBankConfig
Dim pDuctView As IMMDuctView
Set pDuctBankConfig = New MMDuctBankConfig
Set pDuctView = New MMDuctView
'asociate list objects with duct configuration object
Dim pDuctBankConfigList As ID8List
Dim pDuctViewList As ID8List
Set pDuctViewList = pDuctView
Set pDuctBankConfigList = pDuctBankConfig

Dim pMMListItem As IMMPersistentListItem
Set pMMListItem = pDuctBankConfigList
'load the blob into list objects
pMMListItem.LoadFromStream pBlob

Dim pDuctDefinition As IMMDuctDefinition


If Not (pDuctBankConfigList Is Nothing) Then 'And (Not IsNull(pDuctBankConfigList))
pDuctBankConfigList.Reset
Do
Set pDuctViewList = pDuctBankConfigList.Next
If Not (pDuctViewList Is Nothing) Then 'And (Not IsNull(pDuctViewList))
pDuctViewList.Reset
Do
Set pDuctDefinition = pDuctViewList.Next
If Not (pDuctDefinition Is Nothing) Then 'And (Not IsNull(pDuctDefinition))
'MsgBox pfeat.OID & "-" & pDuctDefinition.availability & "-" & pDuctDefinition.ductID & "-" & pDuctDefinition.diameter
TextStream.WriteLine iCount & "," & pfeat.OID & "," & pDuctDefinition.availability & "," & pDuctDefinition.ductID & "," & pDuctDefinition.diameter & "," & pDuctDefinition.ductNumber & "," & pDuctDefinition.Material


End If
Loop While Not (pDuctDefinition Is Nothing) ' And (Not IsNull(pDuctDefinition))
End If
Loop While Not (pDuctViewList Is Nothing) ' And (Not IsNull(pDuctViewList))
End If
Set pDuctView = Nothing
Set pDuctBankConfig = Nothing
Set pBlob = Nothing
myEnd:
Set pfeat = pftCursor.NextFeature
Loop
TextStream.Close
Set TextStream = Nothing
Set FileSystem = Nothing
End Sub

No comments: