How to get ListBox Values from a agent

Hi,

I have a form with a embedded view in that when i select some documents and click a button whichis on that form, I am calling a agent which will display the field values of a selected documents.

The agent I have written in a Lotus Script.

Everything is working properly but Problem with the ListBox field values. Its displaying only the first Item in a list box. I am pasting my code, In that “Proj_Team” is a ListBox.

How do I display all the elements in a ListBox?

Here is the code

==============================================

Sub Initialize

Dim session As New NotesSession 

Dim docSubmit As NotesDocument 

Dim varDocUNID As Variant 

Dim docSelected As NotesDocument 

Dim total As Double 

Dim Total_GRA As Double

Dim Total_GRB As Double

Dim Total_GRC As Double

Dim db As NotesDatabase 

Dim arrsize As Integer

total = 0 

'Get the document that was submitted with the embedded form

Set docSubmit = session.DocumentContext 

Set db = docSubmit.ParentDatabase 



Print " <HEAD>"



Print |	</HEAD>|

Print |<BODY onload="window.print()">| 



'Setup the web page's font 

Print |<Font Face="Verdana" size="2">|

’ Print ||

Print "<H3><center>Product/Project Billings</center></H3>"

'Get the field that contains the UNID’s of the selected documents (array)

varDocUNID = docSubmit.GetItemValue("$$SelectDoc")  

'Make sure that at least one document was selected

If varDocUNID(0) = "" And Ubound(varDocUNID) = 0 Then 

	Print "No documents were selected.<BR>" 

Else 

	'Print "The customer orders you selected were: " 

	'Print"<BR>"border: solid 1px darkgreen

	Print | <TABLE border=".5" bordercolorlight="#000000" align="center" width="100%" cellpadding="5">|

	Print |<TR>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">Bill Month</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">Project Name</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">Team</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">Activity</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">GR A</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">GR B</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">GR C</font></TH>|

	Print |<TH bgcolor="#F3F3F3"><font face="Verdana" size="1">Total Effort</font></TH>|

	Print |</TR>|

	'Loop through all the documents that were selected 

	Forall unid In varDocUNID 

		Set docSelected = db.GetDocumentByUNID(unid) 

		

		If Not docSelected Is Nothing Then 

			

			Print|<TR><TD bgcolor="#EAF2FF"><font face="Verdana" size="1">| & docSelected.Bill_Month(0)  & " - " & docSelected.From_Date(0) |</font></TD>|

			Print |<TD bgcolor="#EAF2FF"><font face="Verdana" size="1">| & docSelected.Project_Name(0)  & |</font></TD>|

			Print |<TD bgcolor="#EAF2FF"><font face="Verdana" size="1">| & docSelected.Proj_Team(0)& |</font></TD>|

			Print |<TD bgcolor="#EAF2FF" align="center"><font face="Verdana" size="1">| & docSelected.Activity(0)  & |</font></TD>|

			Print |<TD bgcolor="#EAF2FF" align="center"><font face="Verdana" size="1">| & docSelected.GradeA(0)  & |</font></TD>|

			Print |<TD bgcolor="#EAF2FF" align="center" ><font face="Verdana" size="1">| & docSelected.GradeB(0)  & |</font></TD>|

			Print |<TD bgcolor="#EAF2FF" align="center"><font face="Verdana" size="1">| & docSelected.GradeC(0)  & |</font></TD>|

			Print |<TD bgcolor="#EAF2FF" align="center"><font face="Verdana" size="1">| & docSelected.GradeA(0) + docSelected.GradeB(0) +docSelected.GradeC(0) & |</font></TD>|

			'

			'total = total + docSelected.OrderTotal(0) 

			Total_GRA=Total_GRA+docSelected.GradeA(0) 

			Total_GRB=Total_GRB+docSelected.GradeB(0) 

			Total_GRC=Total_GRC+docSelected.GradeC(0) 

			total = Total_GRA+Total_GRB+Total_GRC

			

		End If 

	End Forall 

	Print "</TABLE>"

	Print "</BODY>"

'Print the total of the selected orders

	Print "<BR><BR>" 

	'Print "Total of the orders selected was " & Format(total,"Currency") 

	Print "Total PM effort for Grade A : " & Total_GRA & "<BR>"'Format(total,"Currency") 

	Print "Total PM effort for Grade B : " & Total_GRB & "<BR>" 'Format(total,"Currency") 

	Print "Total PM effort for Grade C : " & Total_GRC & "<BR>"'Format(total,"Currency") 

	Print "Grand Total (PM) : " & total

End If 

'Add a button to return to the view

Print "<BR><BR><BR><BR><BR>" 

'Print |<Center><input type="button" value="Return to view" onClick="history.back();"></Center>| 





Print "<BR><BR>" 

Print| (Signature) |

Print "<BR><BR>" 

Print | Project Manager |

Print "<BR>" 

Print | Date : |

Print |</Font>| 

End Sub

==========================================

Am I doing something wrong in - Print || & docSelected.Proj_Team(0)& ||

Thanks for your suggestions inadvance

regards

Sanjay

Subject: How to get ListBox Values from a agent

The problem is that docSelected.Proj_Team(0) is telling the code to display the first value in the list boxYou would need to use a forall loop or similar to display all the values of the field

E.g. something along these lines

For i=0 to Ubound(docSelected.Proj_Team)

Print etc etc docSelected.Proj_Team(i)

Next

Subject: RE: How to get ListBox Values from a agent

Thanks Its working