ODBC Lookup / Search Field

Hi All

I have a field within an external database that I want to be able to bring into a form, but what I would like to do is have a free text search of this field, for example I would like on my form a search text field where the user can type in a word or description, then they will click on a search button, this will then search through the field on the Associated ODBC linked table and will return a list of items that match this search, the user can then select from the results and this is then returned to a specific field on the form.

How and what is the best way to do this.

Any help is appreciated.

Regards

Djbell

Subject: ODBC Lookup / Search Field

For a while ago I had the same problem…find something in an Oracle View. So I made an agent with connector (Uselsx “*lsxlc”), got the search value from the form, made a sql query with "select … from … where field-to-search-in-table = search value. the result is a field list. Now you can loop through this field list und print out the results. This way is easy and fast.

Subject: RE: ODBC Lookup / Search Field

Hi Ron

Could you go into this a little more with me as I am not quite sure on what you are saying to do.

Regards

Djbell

Subject: RE: ODBC Lookup / Search Field

sorry! ok, i can tell you the situation i had:1 form (web) with a input field to hold the search value. 1 button to start search.

The things to search were in an Oracle DB, connected over ODBC. If people klick the search button, a LotusScript Agent will be started. Over the Query String Decoded i get the search value into the agent

The agent hast in the Options part the Connector part Uselsx “*lsxlc”

In the Initialize Section u need to declare some things (if u like :wink:

Dim ses As LCSession

Dim con As LCConnection

Dim fldLst As New LCFieldList

Dim sSQLQuery As String

then set the stuff:

Set ses = New LCSession

Set con = New LCConnection( “oracle8” )

con.Server = “53.250.217.52”

con.Userid= “YourUserID”

con.Password = “YourPasswort”

Now we’re ready to connect:

con.Connect

If (Not con Is Nothing ) Then

'query example:

sSQLQuery = {SELECT PARENT, PRODUCT_NO, FROM SXM02.V_DSCOMPO

WHERE PARENT = ‘} + strSearchValue + {’ AND PRODUCT_NO <> ‘15AA’}

Execute the query:

If (con. Execute (sSQLQuery , fldLst) = 0) Then 'SQL Query had no Hits

Else

'query has some hits

lngResulCount = con.Fetch( fldLst, 1, 1) ’ get first result

While lResultCount > 0

'main loop throuh all results! for example get the value for ParentID string

strParentID = fldLst.PARENT(0)

'do with the result values what you want

Wend

end if

that’s the main part. With the results in my case i make a html-table and print it out at the end.

Don’t forget to close the connection when you’re finished with reading over odbc:

con.Disconnect

I hope that will help you!

Greetz

Ron