How can i make a good search function to search some data in a browse.
Now I have used a fill-in and when I type text the code below directly search into the browse. Now I would like to use a function that I make once and then can invoke from different procedures.
Do you have any idea how I can do that well. The code below is very old but i dont know how to make a search field like below.
procedure relres:
zoek = "".
zoek1 = "".
OPEN query browse-3 for each register.personeel no-lock use-index i_inlog_code indexed-reposition.
view frame frame-bbb IN WINDOW window-1.
find first register.personeel use-index i_inlog_code no-error.
current-record = recid(personeel).
if available(personeel) then current-record = recid(personeel).
REPOSITION browse-3 TO RECID Current-Record.
Method-Return = browse-3:SELECT-FOCUSED-ROW().
update zoek with no-label frame frame-bbb editing:
readkey.
ac = length(zoek1).
if keyfunction(lastkey) = "return" then do:
zoeknum = 0.
zoeknum = INT(zoek1) NO-ERROR.
IF INT(zoeknum) <> 0 THEN FIND register.personeel NO-LOCK WHERE register.personeel.inlog_code = INT(zoek1).
IF available(personeel) THEN leave.
end.
if keyfunction(lastkey) = "end-error" then do:
leave.
end.
if keyfunction(lastkey) = "cursor-down" then do:
method-return = browse-3:select-next-row().
zoek = register.personeel.achternm.
zoek1 = "".
display zoek with frame frame-bbb.
zoek:cursor-offset = 1.
end.
if keyfunction(lastkey) = "cursor-up" then do:
method-return = browse-3:select-prev-row().
zoek1 = "".
zoek = register.personeel.achternm.
display zoek with frame frame-bbb.
zoek:cursor-offset = 1.
end.
if keyfunction(lastkey) = "backspace" then do:
ac = length(zoek1) - 1.
zoek1 = substring(zoek1,1,ac).
apply lastkey.
current-record = recid(personeel).
find first register.personeel use-index iachternaam where register.personeel.achternm begins zoek1 no-error.
if available(personeel) then current-record = recid(personeel).
REPOSITION browse-3 TO RECID Current-Record.
Method-Return = browse-3:SELECT-FOCUSED-ROW().
display " " @ zoek with frame frame-bbb.
display zoek1 @ zoek with frame frame-bbb.
end.
else do:
letter = chr(lastkey).
if index("1234567890 .,-ABCDEFGHIJKLMNOPQRSTUVWXYZ",caps(letter)) > 0 then do:
zoek1 = zoek1 + letter.
current-record = recid(personeel).
find first register.personeel use-index iachternaam where register.personeel.achternm begins zoek1 no-error.
if available(personeel) then current-record = recid(personeel).
REPOSITION browse-3 TO RECID Current-Record.
Method-Return = browse-3:SELECT-FOCUSED-ROW().
apply lastkey.
display " " @ zoek with frame frame-bbb.
display zoek1 @ zoek with frame frame-bbb.
end.
end.
end.
Found the solution for a good search
On the right end of the bottom row in the rich code editor there is a button which will allow you to paste in code that will get displayed in a readable format. I suggest that as the first step.
I would suggest looking at using dynamic queries to make the code reusable.
cant set my code as code only as text like this.
i will look at dynamic queries. many thanks.
It is the button that looks like a highlighter pen. Hover over it and it will say "Insert code using Syntaxhighlighter". Click on it and it will pop up a box into which you can paste your code.
Here is a pictorial representation of what Thomas said:
Found it, in IE it wasnt visable :)
Found the solution for a good search