Retrieve result of Agent in new Window(IE)

I have a $$Return field in form for run Agent and I want to result of $$Return field display in new Window(IE)

Value of $$Return field

DbPath := @ReplaceSubstring(@Subset(@DbName;-1);“\”;“/”);

DocID := @Text(@DocumentUniqueID);

“[/” + @Text(DbPath) +“/(SearchWeb)?OpenAgent&DocID=”+@Text(DocID)+“&index=1]”

Code Agent (SearchWeb)

Dim …

Dim DocIndex As Integer

		DocIndex = 1

		If sword <> "" Then

			Call db.UpdateFTIndex(True)

			Call docCollection.FTSearch(sword, docCollection.count)						

			

			Set doc = docCollection.GetFirstDocument 

			docSum = 0

			Do While Not doc Is Nothing

				If doc.FTSearchScore <> 0 Then

					docSum = docSum + 1

				Else

					Exit Do

				End If

				Set doc = docCollection.GetNextDocument(doc)

			Loop

			

			If index > docSum Then

				index = docSum

			End If

			If index < 1 Then

				index =1

			End If

			If docSum > 0 Then

				

				Print "<Body background=/icons/Offman/bground.jpg bgproperties=fixed>"

				

				Print "<title>Kết quả tìm kiếm</title>"

				Print "<TABLE align=center border=0 cellspacing=0 width=770>"

				Print "<TR><TD bgcolor=#e0ffff><font face=Arial size=2 color = darkblue><B>Kết quả tìm kiếm  ("&Str(docSum)&")</B></TD></TR>"

				Print "</TABLE><br>"

				Print "<TABLE align=center style=border:1px solid:#094Ac4 cols=4 cellspacing=0 width=600>"

				Print "<TR bgcolor=#d3d3d3><TD width = 30 align=center><font face=Arial size=2 color = darkblue><B>STT</B></font></TD>"

				Print "<TD width = 300 align=left><font face=Arial size=2 color = darkblue><B>Tiêu đề</B></font></TD>"

				Print "<TD width = 100 align=center><font face=Arial size=2 color = darkblue><B>Loại văn bản</B></font></TD>"

				Print "<TD align=center><font face=Arial size=2 color = darkblue><B>Thời gian</B></font></TD></TR>"

				

				Set doc= docCollection.GetFirstDocument

				DocIndex = 1

				

                     'Print "DocStep = " & Cstr(DocStep) & "<br>"

                     'Print "DocIndex = " & Cstr(DocIndex) & "<br>"

                     'Print "Index = " & Cstr(Index) & "<br>"

                     'Print "DocSum = " & Cstr(DocSum) & "<br>"

				Call docCollection.RemoveAllFromFolder("SearchRes")

				Call docCollection.PutAllInFolder("SearchRes")

				Do While Not doc Is Nothing

					If (doc.FTSearchScore <> 0)Then

						If (DocIndex >= index) And (DocIndex < Cint(index + docStep)) Then

							If doc.ObjectType(0) = "CVE" Then

								SObjType$ = "Công văn đến"

								docid$ =doc.DocID(0)

								DateCreated$=Cstr(Datevalue(doc.CVETime(0)))

							End If

							If doc.ObjectType(0) = "CVS" Then

								SObjType$ = "Công văn đi"

								docid$ =doc.DocID(0)

								DateCreated$=Cstr(Datevalue(doc.CVSTime(0)))

							End If

							If doc.ObjectType(0) = "Sheet" Then

								SObjType$ = "Tờ trình"

								docid$ =doc.SheetID(0)

								DateCreated$=Cstr(Datevalue(doc.SheetCreatedDate(0)))

							End If

							If doc.ObjectType(0) = "Task" Then

								SObjType$ = "Nhiệm vụ"

								docid$ =doc.TaskID(0)

								DateCreated$=Cstr(Datevalue(doc.TaskCreatedDate(0)))

							End If

							

							hreftitle$ = doc.title(0)

							If hreftitle$ ="" Then

								hreftitle$ = "Văn bản"

							End If

							

							urllink$ = "<a  href = /" + OtherDbPath +"/(AllByID)/" + docid$  + "?OpenDocument>"  + hreftitle$ +"</a><br>"

							

							Print "<TR><TD align=center><font face=Arial size=2 color = darkblue><B>" &Str(DocIndex) & "</B></font></TD>"

							Print "<TD align=left><font face=Arial size=2 color = darkblue>" & urllink$ & "</font></TD>"                          

							Print "<TD align=center><font face=Arial size=2 color = darkblue>" & SObjType$ &"</font></TD>"                          

							Print "<TD align=center><font face=Arial size=2 color = darkblue>" & DateCreated$ & "</font></TD></TR>"                          

						End If

						DocIndex = DocIndex + 1

					Else

						Exit Do

					End If

					Set doc = docCollection.GetNextDocument(doc)

				Loop

				Print "</TABLE>"

Please help!

Subject: Retrieve result of Agent in new Window(IE)

You could start the agent from a link with target=_blankRun agent

Or if you need to compute the parms based on the open document:

Run Agent

and then code a javascript function runAgent that computes the agent+parameters url, before calling the agent.

  • using window.open