× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Brian, here is how I do it.  I don't send the values to a field, but maybe
this will help get you in the right direction.  These are just partial
codes, so if it looks incomplete, well, it is.  Let me know if any
sections need further detail.

First, the form from the web, a $$Return Field has the following:

@Return("[http://www.website.com/mydb.nsf/Rate?OpenAgent&"+@Trim(FromZip)
+"&"+ @Trim(FromAcct)
+"&"+@Trim(ToZip)+"&"+@Trim(InOut)+"&"+@Trim(PreColl)+"&"+ @Trim(class1)
+"&"+ @If(@Contains(weight1;".");@Left(@Trim(weight1);".");@Trim(weight1))
+"&" +@Trim(class2)+"&" +
@If(@Contains(weight2;".");@Left(@Trim(weight2);".");@Trim(weight2))
+"&"+@Trim(class3)+"&"+@If(@Contains(weight3;".");@Left(@Trim(weight3);".");@Trim(weight3))+"&"
+ @Trim(class4) +"&"+
@If(@Contains(weight4;".");@Left(@Trim(weight4);".");@Trim(weight4))
+"&"+@Trim(class5)+"&"+
@If(@Contains(weight5;".");@Left(@Trim(weight5);".");@Trim(weight5))+"&"+
@Trim(ThirdParty)+"]")

All that big ol' thing does is take the values out of each field and
seperate them with an &.  These are passed to the agnt that is run with
the OpenGent command.

Within th agent, the first thing to do is seperate the values that are in
the big string.  That is accomplished like so:

'******************************************************************
'*  The variables correspond to the parameters passed   *
'*  to the RPG program on the AS/400 an must be          *
'*  the exact same size as the parameters in the RPG.     *
'*******************************************************************

        Dim rate5 As String * 7
        Dim minim As String * 7
        Dim thirdp As String * 1
        Dim class1d As String
        Dim class2d As String
        Dim class3d As String
        Dim class4d As String
        Dim class5d As String
        Dim amount1 As String
        Dim amount2 As String
        Dim amount3 As String
        Dim amount4 As String
        Dim amount5 As String
        Dim defweight As String
        Dim defrate As String
        Dim defamt As String
        Dim factnam As String
        Dim tactnam As String
        Dim zipchange As String
        Dim warning As String
        Dim warning2 As String

        Dim freightchar As String
        Dim discperc As String
        Dim discdoll As String
        Dim fuelperc As String
        Dim fueldoll As String
        Dim nettotal As String
        Dim tariff As String
        Dim effdate As String

        seqnum = Year(Now) & Hour(Now) & Minute(Now) & Second(Now)

        Set session = New NotesSession
        Set conn = New ODBCConnection
        Set query = New ODBCQuery
        Set data = New ODBCResultSet
        Set result = New ODBCResultSet
        Set query.connection = conn
        Set data.query = query
        Set doc = session.DocumentContext
        Set db = session.CurrentDatabase
        conn.SilentMode = True
        URLString = doc.Query_String(0)
        URLLength = Len(URLString)



'**********************************************************************
'  Get the first parameter.
'**********************************************************************
        ParamPosition = Instr(URLString,"&") + 1
        ParamStop = Instr(ParamPosition, URLString, "&")
        ParamLen = (ParamStop - ParamPosition)
        fromzip = Mid(URLString, ParamPosition,         ParamLen)
        fromziphold = Mid(URLString, ParamPosition,     ParamLen)

'**********************************************************************
'  Get the second parameter.
'**********************************************************************
        ParamPosition = (ParamStop + 1)
        ParamStop = Instr(ParamPosition, URLString, "&")
        If ParamStop = 0 Then
                ParmContinue = 0
                ParamLen = (URLLength - ParamPosition) + 1
        Else
                ParmContinue = 1
                ParamLen = (ParamStop - ParamPosition)
        End If
        fromacct = Mid(URLString, ParamPosition,        ParamLen)

'**********************************************************************
'  Get the Third parameter.
'**********************************************************************
        ParamPosition = (ParamStop + 1)
        ParamStop = Instr(ParamPosition, URLString, "&")
        If ParamStop = 0 Then
                ParmContinue = 0
                ParamLen = (URLLength - ParamPosition) + 1
        Else
                ParmContinue = 1
                ParamLen = (ParamStop - ParamPosition)
        End If
        tozip = Mid(URLString, ParamPosition,   ParamLen)
        toziphold = Mid(URLString, ParamPosition,       ParamLen)

'**********************************************************************
'  Get the Fourth parameter.
'**********************************************************************
        ParamPosition = (ParamStop + 1)
        ParamStop = Instr(ParamPosition, URLString, "&")
        If ParamStop = 0 Then
                ParmContinue = 0
                ParamLen = (URLLength - ParamPosition) + 1
        Else
                ParmContinue = 1
                ParamLen = (ParamStop - ParamPosition)
        End If
        inout = Mid(URLString, ParamPosition,   ParamLen)
        If inout = "I" Then
                inoutdisp = "Inbound"
        Else
                inoutdisp = "Outbound"
        End If

'**********************************************************************
'  Get the Fifth parameter.
'**********************************************************************
        ParamPosition = (ParamStop + 1)
        ParamStop = Instr(ParamPosition, URLString, "&")
        If ParamStop = 0 Then
                ParmContinue = 0
                ParamLen = (URLLength - ParamPosition) + 1
        Else
                ParmContinue = 1
                ParamLen = (ParamStop - ParamPosition)
        End If
        precoll = Mid(URLString, ParamPosition,         ParamLen)
        If precoll = "P" Then
                precolldisp = "Prepaid"
        Else
                precolldisp = "Collect"
        End If

'**********************************************************************
'  Get the Sixth parameter.
'**********************************************************************
        ParamPosition = (ParamStop + 1)
        ParamStop = Instr(ParamPosition, URLString, "&")
        If ParamStop = 0 Then
                ParmContinue = 0
                ParamLen = (URLLength - ParamPosition) + 1
        Else
                ParmContinue = 1
                ParamLen = (ParamStop - ParamPosition)
        End If
        class1 = Mid(URLString, ParamPosition,  ParamLen)

        If ParmContinue=1 Then

You get the picture.  Just keep going till you have each value set to a
variable.  Then I pass the stuff off to the AS/400 to run a program and
get a return.

        If Not conn.ConnectTo("S1027626", "notes", "notes") Then
                error% = conn.getError
                Print "<br>" & conn.getErrorMessage(error%) & "</br>"
                Print "<br>"
                Print conn.getExtendedErrorMessage(error%)
                Print Str$(error%)
                Exit Sub
        End If

'****************************************
'  AS/400 Call
'****************************************
        Query.SQL = "CALL LTL400V312.txr007('" & seqnum & "', '" &
fromacct & "', '" & inout & "','" & precoll & "', '" & thirdp & "', '" &
fromzip & "', '" & tozip & "', '" & class1 & "', '" & class2 & "', '" &
class3 & "', '" & class4 & "', '" & class5 & "', '" & weight1 & "', '" &
weight2 & "', '" & weight3 & "', '" & weight4 & "', '" & weight5 & "')"
        If Not data.Execute Then
                Print data.GetExtendedErrorMessage
        End If

        query.SQL = "SELECT * FROM LTL400V313.TXP007 WHERE (TXPSEQ = '"&
seqnum &"')"
        If Not data.Execute Then
                Print data.GetExtendedErrorMessage
        End If

        data.nextrow
        rate1 = data.GetValue("TXPRT1")
        rate2 = data.GetValue("TXPRT2")
        rate3 = data.GetValue("TXPRT3")
        rate4 = data.GetValue("TXPRT4")
        rate5 = data.GetValue("TXPRT5")
        minim = data.GetValue("TXPMIN")
        amount1 = data.GetValue("TXPAM1")
        amount2 = data.GetValue("TXPAM2")
        amount3 = data.GetValue("TXPAM3")
        amount4 = data.GetValue("TXPAM4")
        amount5 = data.GetValue("TXPAM5")
        defweight = data.GetValue("TXPDFW")
        defrate = data.GetValue("TXPDFR")
        defamt = data.GetValue("TXPDFA")
        freightchar = data.GetValue("TXPGRS")
        discperc = data.GetValue("TXPDSP")
        discdoll = data.GetValue("TXPDSA")
        fuelperc = data.GetValue("TXPFSP")
        fueldoll = data.GetValue("TXPFSA")
        nettotal = data.GetValue("TXPNET")
        tariff = data.GetValue("TXPTC")
        effdate = data.GetValue("TXPEFF")
        tactnam = data.GetValue("TXPTNM")
        factnam = data.GetValue("TXPFNM")
        tozip = data.GetValue("TXPTZP")
        fromzip = data.GetValue("TXPFZP")
        zipchange = data.GetValue("TXPOVR")

Actually, it just passes the values to a program on the 400, the program
there writes it out to a file that I read for the result I want.  Then it
jsut a matter of displaying the result on the new page:

'*****Open Web Page*****
        URL =
"http://www.mypage.com:8081/Rates.nsf/Display?OpenForm&Rate1="; &
Trim(seqnum) & "?" & Trim(fromacct) & "?" & Trim(fromzip) & "?" &
Trim(toacct) & "?" & Trim(tozip) & "?" & Trim(class1) & "?" &
Trim(weight1) & "?" & Trim(class2) & "?" & Trim(weight2) & "?" &
Trim(class3) & "?" & Trim(weight3) & "?" & Trim(class4) & "?" &
Trim(weight4) & "?" & Trim(class5) & "?" & Trim(weight5) & "?" &
Trim(rate1) & "?" & Trim(rate2) & "?" & Trim(rate3) & "?" & Trim(rate4) &
"?" & Trim(rate5)

'*****Display information in new web page*****
Print "<BODY TEXT="000000"
BACKGROUND='/Rates.nsf/images_bkgd.jpg?OpenImageResource'>"
Print "<BR>"
Print   "<CENTER>"
Print "<H4 ALIGN=CENTER><FONT COLOR='BLACK'><font size=4><B><I>  Quote
Number = " & seqnum & "</I></H4>"
Print   "<B><FONT SIZE=3 COLOR='BLACK'>Estimated Rate Quote from " &
fromzip & " to " & tozip & "</FONT></B><BR>"
Print   "</DIV><BR>"
Print "<TABLE BORDER=0>"
Print "<TR VALIGN=top><TD WIDTH="400"><DIV ALIGN=center><B><FONT
COLOR='BLACK'>Account: " & factnam & "</FONT></B></DIV></TD></TD>"
Print "</TABLE>"
Print "<TABLE BORDER=0>"
'Print "<TR VALIGN=top><TD WIDTH="200"><DIV ALIGN=left><B><FONT
COLOR='BLACK'>Freight Charges:</FONT></B></DIV></TD><TD WIDTH="150"><DIV
ALIGN=left><B><FONT COLOR='BLACK'> $ " & freightchar &
"</FONT></B></DIV></TD>"
Print "<TR VALIGN=top><TD WIDTH="200"><DIV ALIGN=left><B><FONT
COLOR='BLACK'>" & inoutdisp & "</FONT></B></DIV></TD></TD><TD
WIDTH="100"><DIV ALIGN=center><B><FONT COLOR='BLACK'>" & precolldisp &
"</FONT></B></DIV></TD></TD>"
Print "</TABLE>"
Print "<BR>"
Print   "<CENTER>"
Print "<TABLE BORDER=0>"

Once again, you get the idea.  I wont paste the whole thing cause it's
kinda big.  Finally, dont forget to disconnect like a good programmer ; -
P
'*****************************************
'  Done!!!
'*****************************************

        data.close(DB_CLOSE)
        conn.Disconnect

I hope this helps in some way.

-JS




clib@gptruck.com
Sent by: domino400-admin@midrange.com
07/29/2002 04:08 PM
Please respond to domino400


        To:     domino400@midrange.com
        cc:
        Subject:        Forms and Agents


Hi folks.

I apologize in advance for lack of clarification; my brain is racked a
bit.

Is it possible to run an agent from a web-based form when it is first
opened?  I've tried running an agent from WebQueryOpen and Initialize, but
none of the output from that agent shows up when the page loads. What I'm
trying to do is pass a few variables in the query string, then (from
within
an agent) parse out each of the needed variables from the query string and
then use those variables in an sql query; and from the data set that the
query returns, I am attempting to populate certain fields. I've written
the
agent to do all this--it is just a matter of getting the form and the
agent
to work together.

Any ideas?

Thanks,

Brian Cline
G&P Trucking Company
clib@gptruck.com
800.922.1147

_______________________________________________
This is the Lotus Domino on the iSeries / AS400 (DOMINO400) mailing list
To post a message email: DOMINO400@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/domino400
or email: DOMINO400-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/domino400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.