How can I print info from an agent to a view?

Here is a copy of the agent that I have been working on. The form that I have sends two values to the agent using webquerysave, “get”, querystringdecoded and a saveoptions field.

I’ve been told I should: Let the document the user saves, continue saving, and THEN change the “Form” field and do a Print statement to redirect to that document.

How do I do this? Do I have to place code in the view as well? And what should it say? Thank you all in advance!

'—Code for sql query after parsing values and making odbc connection—

'retrieve parsed variables from user	

torig2 = AgentArgs ("t_orig")

tdest2 =  AgentArgs ("t_dest")



'Send query to SQL database

qry.SQL = "SELECT DISTINCT torig, tdest, tldest, tlorig, transoption, tlduration FROM Trans WHERE opt_num ='1' AND torig='" + torig2 + "' AND tdest='" + tdest2 + "'"



result.Execute	

If Not result.Execute Then

	result.GetErrorMessage

	Print "No chance"

End If



'Retrieve variables from SQL Query

Do

	result.NextRow 

	tldest = result.GetValue("TLDEST", tldest)

	tlorig = result.GetValue("TLORIG", tlorig)

	transoption = result.GetValue("TRANSOPTION",transoption)

	tlduration = result.GetValue("TLDURATION", tlduration)	

	

	Print"<table cellpadding = 10 cellspacing = 3>"	

	Print"<tr>"

	Print"<td>"

	Print tlorig " to "

	Print"<td>"

	Print tldest

	Print"<td>"

	Print "Using " + transoption

	Print"<td>"

	Print  tlduration + " Mins"

	Print "<tr>"	

	Print"</table>"

	

Loop Until result.IsEndOfData

(I was told the final print statement would look like this:

'Print "[/" & db.ReplicaID & "/0/" & doc.UniversalID & "]"



result.Close(DB_CLOSE)

con.Disconnect

'-close connection

End Sub

Subject: How can I print info from an agent to a view?

Hi,

If I’ve understood your question correctly you have a document that triggers a webquerysave agent that carries out your sql query and gets a set of documents that you the want to display back to the browser. If your form does not have a $$Return field then any print statements that you have within your agent will output to the browser, displaying a new page for you. So, you should change your line

'Print “[/” & db.ReplicaID & “/0/” & doc.UniversalID & “]”

to

Print “<a href=”“/” & db.ReplicaID & “/0/” & doc.UniversalID & “?opendocument”“>some descriptive text”

You should replace the “some descriptive text” with a value from each document such as a subject or title field. This will then display your page with all.your htmltable commands plus a list of url links to each document you retrieved in your query. Hope that helps

Subject: RE: How can I print info from an agent to a view?

thank you for your reply. The form triggers an sql query agent that receives variables and retrieves information from an external database.

(I have the webquerysave and saveoptions functions in the document but im not sure if webquerysave even works?) I’m using “get” and a form action using html to trigger the agent.

I tried your suggestion but the only thing that popped up was a link to the view name that I input? Is there another suggestion? or am I doing something wrong?