GET statement

Yohn

Member
Hy.
Can I use GET statement for find some record in table and compare it with fill in value. How do I do that?

I use ON ANY-PRINTABLE OF statement.
 

LarryD

Active Member
Unless I'm mistaken, the way you asking this question sounds as if you have no experience at all with the Progress 4GL/ABL. The simple answer is yes you can easily do it with a simple fill-in update and query (and I'm totally confused as to what the ANY-PRINTABLE trigger has to do with it). A cynical person might think that you were given a task where you have no idea how to write Progress code and you are looking for someone to do it for you... ;-)

Anyway, I'd strongly recommend you look into taking some basic classes in the Progress ABL. There are a number of readily available resources (including Progress) where you can get such training.
 

Yohn

Member
Thanks.
Actually I am beginner in Progress, so until I learn basic very well I will ask stupid questions.
I use ON-ANY PRINTABLE because I want position to row when I start typing in fill-in. For example if I start typing yoh that positions to first record in row that matches yoh.
ok?
 

LarryD

Active Member
Given that we don't know how the tables/indexes/query is structured....

For a query where the fill-in is not able to be found directly with an index here is one way ( cut/paste/edited from code, so no guarantees ;-) ):

def var pressed-keys as char no-undo.
def var record-id as recid no-undo.

on backspace,any-printable of ... do:

assign pressed-keys = pressed-keys + keylabel(lastkey).

key-check:
do:
/* Zero in */
get first {&queryname}.
repeat while available {&filename}:
if {&filename}.{&fieldname} begins pressed-keys
then leave key-check.
get next {&queryname}.
end.

pressed-keys = keylabel(lastkey).

/* Find first */
get first {&queryname}.
repeat while available {&filename}:
if {&filename}.{&fieldname} begins pressed-keys
then leave key-check.
get next {&queryname}.
end.

/* No match */
find first {&filename} no-lock where
{&filename}.{&fieldname} begins pressed-keys
{&recspecs} {&useindex} no-error.

if not available {&filename} then do:
... do whatever if none start with entered characters ...
end.

/* Find next */
get first {&queryname}.
repeat while available {&filename}:
if {&filename}.{&fieldname} > pressed-keys
then leave key-check.
get next {&queryname}.
end.

/* Find previous */
get last {&queryname}.
repeat while available {&filename}:
if {&filename}.{&fieldname} < pressed-keys
then leave key-check.
get prev {&queryname}.
end.

pressed-keys = "". /* Start over */

get first {&queryname}.

end. /* End of key-check do block. */

assign record-id = recid({&filename}).

reposition {&queryname} to recid(record-id).

..... stuff ......

end. /* of trigger block */

If you can find it via index, here is one way:

def var pressed-keys as char no-undo.
def var record-id as recid no-undo.

on backspace,any-printable of ... do:

assign pressed-keys = pressed-keys + keylabel(lastkey).

find next {&filename} NO-LOCK
where ... other parts of key ...
and {&filename}.{&fieldname} begins pressed-keys
NO-ERROR.

if NOT available {&filename}
then
find first {&filename} NO-LOCK
where ... other parts of key ...
and {&filename}.{&fieldname} begins pressed-keys
NO-ERROR.

if NOT available {&filename} then do:

.... what to do if none available ....

end.
else do:
reposition {&queryname} to recid({&filename}).

... stuff ...

end.

end. /* of trigger block */
 

Yohn

Member
Thank, you help me a lot. No I know what to do - you clear my way to objectives.
Ones more THANK YOU VERY MUCH.
yeah!
 

Yohn

Member
here is sample of code:

ON ANY-PRINTABLE OF browseDropDown IN FRAME frameDropDown
DO:
IF KEYFUNCTION(LASTKEY) = "backspace"
OR KEYFUNCTION(LASTKEY) = "delete"
THEN
kaj = SUBSTRING(kaj, 1, LENGTH(kaj) - 1).
ELSE
kaj = kaj + LAST-EVENT:LABEL.
kaj:SCREEN-VALUE = kaj.
MESSAGE kaj
VIEW-AS ALERT-BOX.
GET FIRST queryDropDown.

FIND FIRST person WHERE person.name BEGINS kaj NO-LOCK NO-ERROR.
IF person.name BEGINS kaj THEN DO:
MESSAGE osoba.naziv
VIEW-AS ALERT-BOX.
REPOSITION queryDropDown TO ROWID rowid(person).
END.
ELSE
LEAVE.
END.

when I start program he finds first person, and after that he shows next error: can not reposition the query queryDropDown to recid/rowid(e)
 
Top