PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Return to the selected record
Return to the selected record
Iniciado por Henk Ouwejan, 30,abr. 2016 21:57 - 3 respuestas
Publicado el 30,abril 2016 - 21:57
Hi all,
Suppose the selected record in the table is number four. After modifying the record (using a form page) and returning to the table page always the first record is selected. I would like when returning to the table page the same record (no. four) is selected. What must I do change in my code?

Thanks in advance,

code I'm using now:

Table page, modify button:
IF TableSelect(TABLE_QRY_products)=-1 THEN RETURN
HReadSeek(products,id,TABLE_QRY_products.COL_ID)
PageDisplay(PAGE_Form_product)

Form page, validate button:
PageToFile()
HSave(products)
IF PreviousPage()<>“” THEN
PageDisplay(PreviousPage)
ELSE
PageDisplay(PAGE_Home)
END
Publicado el 05,mayo 2016 - 04:46
Here´s the code I use:


First create a global variable to hold the record you need to return to, type int or 8-byte int depending on your keys
example: MyGlovar

Then on your Modify or Update button:

MyGlovar = TableSelect(Table_MyQry)

Then when returning to the Products page on the initialization section

IF MyGlovar <> 0 THEN
Refresh your qry and
TableDisplay(TABLE_MyQry,MyGlovar)
END

Hope it helps
Publicado el 09,mayo 2016 - 09:42
Hi Diego,

Yes it works. Thanks.
Publicado el 19,mayo 2016 - 05:08
"Global" seems to be overkill here...

Is there a concept of a private variable in wlanguage whereas it would be automatically released as soon as the code that created it was closed?

I say "private" because of my VFP background where we had local, private and public (global) variables. The scope of a private variable is seen by the process that creates it and all subsequent child processes. Global is seen everywhere and stays alive until the app is closed or the variable is explicitly released. And of-course local is only seen where it is called and nowhere else.

Thanks,
Stanley