Accessing elements in a Notes Object

I cannot access data that is in an object. I must not be using the correct object reference variable. When I run the agent in debugger, I can see that the data is there, it is just a nested value. I am trying to access the associated tracking numbers for each PO. With the following code, I get the PO numbers but nothing populated the subgroups collection. I have tried many variations with the code, and no luck! I have been working on a solution for this code for over 3 weeks. If you need more info, I can append it.

Private Const OUTERARRAYREDIM = 10

Private Const INNERARRAYREDIM = 1000

Class Collection

Private thisObjArray() As Variant

Private thisObjCount As Long

Private thisObjIndex As Long



Property Get Count As Long

	Me.Count = thisObjCount

End Property



Property Get Element (i As Long) As Variant

	If Isobject(thisObjArray(i)) Then

		Set Me.Element = thisObjArray(i)

	Else

		Me.Element = thisObjArray(i)

	End If

End Property 



Property Set Element (i As Long) As Variant

	If Isobject(Me.Element) Then

		Set thisObjArray(i) = Me.Element

	Else

		thisObjArray(i) = Me.Element

	End If

End Property 



Property Get FirstElement As Variant

	If thisObjCount > 0 Then

		thisObjIndex = 0

		If Isobject(Me.Element (thisObjIndex)) Then

			Set Me.FirstElement = Me.Element (thisObjIndex)

		Else

			Me.FirstElement = Me.Element (thisObjIndex)

		End If

	Else

		Set Me.FirstElement = Nothing

	End If

End Property 



Property Get NextElement As Variant

	If thisObjIndex < thisObjCount-1 Then

		thisObjIndex = thisObjIndex + 1

		If Isobject(Me.Element (thisObjIndex)) Then

			Set Me.NextElement = Me.Element (thisObjIndex)

		Else

			Me.NextElement = Me.Element (thisObjIndex)

		End If

	Else

		Set Me.NextElement = Nothing

	End If

End Property

Private Sub outputElement (theHandle As Integer, theRecordDoc As NotesDocument, theGroup As TokenGroup)

	If Debug > 1 Then Print "+QueueHandler.outputElement"

	Dim groups As Collection

	Dim group As TokenGroup

	Dim thisGroups As TokenGroup

	Dim subgroups As Collection

	Dim subgroup As TokenGroup

	Dim delim As String

	Dim i As Long, ii As Long

	Dim j As Long, jj As Long, k As Long

	Dim outputDoc As NotesDocument

	Dim v As Variant, x As Variant

	'Assumes the loop 10 or no loop

	If theRecordDoc.Loop (0) <= 10 And theGroup.Parent Is Nothing Then

		Print "A 10 Loop"

		Set outputDoc = New NotesDocument (ThisDb)			

		For j = 0 To Ubound (theRecordDoc.TokenFmt)

			

			

			Call Me.evaluateToken (outputDoc, theGroup, theRecordDoc.TokenFmt (j), j+1)

		Next

		

		If theRecordDoc.Content (0) <> "" Then

			Call Me.evaluateToken (outputDoc, theGroup, theRecordDoc.Content (0), 1 )

		End If

		

		v = Me.evaluateToken (outputDoc, theGroup, theRecordDoc.Select(0), 0)	

		

		If v (0) <> "0" Then Call Me.outputDocument (theHandle, outputDoc, theRecordDoc)

		outputDoc.Form = "output"

		Call outputDoc.Save( False, True )

				'Delete outputDoc

	Elseif theRecordDoc.Loop (0) = 101 And theGroup.Parent Is Nothing Then

			' go here if 101 loop   ...SJR

		Print "A 101 Loop"

		Set groups = theGroup.Group (Cstr (theRecordDoc.Loop (0)))

		If Not (groups Is Nothing) Then

			For i = 0 To groups.Count-1

				

				Set outputDoc = New NotesDocument (ThisDb)

				Set group = groups.Element (i)

				For j = 0 To Ubound (theRecordDoc.TokenFmt)

					

					Call Me.evaluateToken (outputDoc, group, theRecordDoc.TokenFmt (j), j+1)

’ Call Me.evaluateToken (outputDoc, group, theRecordDoc.SubTokenFmt (j), j+1)

				Next

				

				If theRecordDoc.Content(0) <> "" Then

					Call Me.evaluateToken (outputDoc, group, theRecordDoc.Content (0), 1)

				End If

				v = Me.evaluateToken (outputDoc, group, theRecordDoc.Select (0), 0)

				

				If v (0) <> "0" Then Call Me.outputDocument (theHandle, outputDoc, theRecordDoc)

				outputDoc.Form = "output"

				Call outputDoc.Save( False, True )

           'Delete outputDoc

				innerLoop=1

				Set subgroups = theGroup.subgroup(Cstr (theRecordDoc.SubLoop (0)))

				

				If Not (subgroups Is Nothing) Then

					For ii = 0 To subgroups.Count-1

						Set outputDoc = New NotesDocument (ThisDb)

						

						Set subgroup = subgroups.Element (ii)

						

						For jj = 0 To Ubound (theRecordDoc.SubTokenFmt)

							

						          Call Me.evaluateToken (outputDoc, subgroup, theRecordDoc.SubTokenFmt (jj), jj+1)

						Next

						If theRecordDoc.Content(0) <> "" Then

							

							Call Me.evaluateToken (outputDoc, group, theRecordDoc.Content (0), 1)

						End If

						

						x = Me.evaluateToken (outputDoc, subgroup, theRecordDoc.Select (0), 0)

						

						If x  (0) <> "0" Then Call Me.outputDocument (theHandle, outputDoc, theRecordDoc)

						outputDoc.Form = "output"

						Call outputDoc.Save( False, True )

           'Delete outputDoc

					Next

				End If

				innerLoop=0

			Next

		End If

Subject: Accessing elements in a Notes Object

Well I haven’t the faintest idea what what all that is about but you might find it helpful to look closely at your use of ‘thisObjCount’. In that code it never gets set.