Enumerating the Coded Concepts of a Context Group Example for VB.NET
Private Function DisplayCodedConcept(ByRef objDS As LTDICLib.LEADDicomDS, ByRef bYesNo As Boolean) As Boolean
Dim sTitle As String
objDS.MoveCodedConceptGroup()
sTitle = "Coded Concept (" & objDS.CurrentContextGroup.ContextIdentifier & ")"
Dim sMsg As String
Dim
sYear As String
Dim sMonth
As String
Dim sDay
As String
With objDS.CurrentCodedConcept
'
Coding Scheme Designator
sMsg
= .CodingSchemeDesignator
& vbNewLine
'
Coding Scheme Version
If
Len(.CodingSchemeVersion) Then
sMsg
= sMsg & .CodingSchemeVersion & vbNewLine
End
If
'
Code Value and Code Meaning
sMsg
= sMsg & .CodeValue
& vbNewLine & .CodeMeaning
& vbNewLine
' Context Group Local Version
If .IsContextGroupLocalVersion Then
sYear = CStr(.ContextGroupLocalVersion.Year)
Do While Len(sYear) < 4
sYear = "0" & sYear
Loop
sMonth = CStr(.ContextGroupLocalVersion.Month)
If Len(sMonth) < 2 Then
sMonth = "0" & sMonth
sDay
= CStr(.ContextGroupLocalVersion.Day)
If
Len(sDay) < 2 Then
sDay
= "0" & sDay
sMsg
= sMsg & sYear & sMonth & sDay & vbNewLine
End
If
' Context Group Extension Creator UID
If Len(.ContextGroupExtensionCreatorUID) Then
sMsg = sMsg & .ContextGroupExtensionCreatorUID & vbNewLine
End If
End With
If bYesNo Then
sMsg = sMsg & vbNewLine & "Continue?"
DisplayCodedConcept = MessageBox.Show(sMsg, sTitle, MessageBoxButtons.YesNo) = DialogResult.Yes
Else MessageBox.Show(sMsg, sTitle, MessageBoxButtons.OK)
DisplayCodedConcept = True
End If
End Function
Private Sub EnumCodedConcepts(ByRef objDS As LTDICLib.LEADDicomDS)
Dim bRet
As Boolean
'
Enumerate the Coded Concepts in the current Context Group (3 possible
ways)
Dim I As
Integer
If True
Then
'
One possible way to enumerate the Coded Concepts
bRet
= objDS.MoveFirstCodedConcept()
Do
While bRet
If
Not DisplayCodedConcept(objDS, True) Then
Exit
Do
End
If
bRet
= objDS.MoveNextCodedConcept()
Loop
ElseIf False Then
' Another way to enumerate the Coded Concepts
For I = 0 To objDS.GetCodedConceptCount() - 1
objDS.FindIndexCodedConcept(I)
If Not DisplayCodedConcept(objDS, True) Then
Exit For
End If
Next
ElseIf
False Then
'
A third way to enumerate the Coded Concepts
bRet
= objDS.MoveLastCodedConcept()
Do
While bRet
If
Not DisplayCodedConcept(objDS, True) Then
Exit
Do
End
If
bRet
= objDS.MovePrevCodedConcept()
Loop
End If
End Sub