Searching a dynamic query

Posted by Eric Andruscavage on 11-Oct-2016 12:51

I want to add a search to a dynamic query query used in a browse. (User types b, browse advances to first row where field starts with b; user types i browse advances to first row where field begins bi, etc)

This is what I have now, stripped down. There must be a better way...

assign vSearch.
hQuery:get-first(no-lock).
assign vRowid = rowid(conv).
repeat:
  hQuery:get-next(no-lock).
  if hQuery:query-off-end then leave.
  assign vRowid = rowid(conv).
  if conv.prognm begins vSearch then leave.
end.

hQuery:reposition-to-rowid(vRowid).

Posted by Peter Judge on 11-Oct-2016 13:00

Have you tried something like this:
 
hAltBuffer:Find-first(‘where table.field begins ‘ + vSearch) no-lock no-error.
 
If hAltBuffer:available then
                hQuery:reposition-to-rowid(hAltBuffer:rowid).
 
 
 

All Replies

Posted by Peter Judge on 11-Oct-2016 13:00

 
hAltBuffer:Find-first(‘where table.field begins ‘ + vSearch) no-lock no-error.
 
If hAltBuffer:available then
                hQuery:reposition-to-rowid(hAltBuffer:rowid).
 
 
 

Posted by Eric Andruscavage on 11-Oct-2016 13:25

Thank you, I knew there had to be a simple solution. I was thinking it should be part of the query object handle, and never looked at the buffer object handle...

This thread is closed