JP
[WD24] - Refresh a table control linked to a file
July 23, 2019 12:37PM
Hi All

Having a slow thinking day ...

I have a table control linked to a file. I have a button which can switch on/off a checkbox/boolean field in the file. But my table control does not reflect this change in the file. Only the records which are not visible on the screen show the change as I scroll to make them visible. Obviously I am missing some sort of "refresh the displayed records" type call. Any suggestions?

Thanks



Edited 1 time(s). Last edit at 07/23/2019 12:55PM by JP.
Re: [WD24] - Refresh a table control linked to a file
July 23, 2019 01:10PM
Hi JP,

In my projects I use Queries to fill tables and HVersion to checkout any modification of related files.
If you want to do the refresh automatic, use procedure with timer mechanism (say every 20s).
Inside this procedure you can write some piece of code using Hversion like this:

CurrentVersion is int = HVersion(filename)
if CurrentVersion <> InitialVersion then
InitialVersion is CurrentVersion
// run the query linked to the Table
end

The InitialVersion is Global variable and can be initialized like: InitialVersion is int = Hversion(filename)

Hope to help you

Regards
Vassilis
Re: [WD24] - Refresh a table control linked to a file
July 23, 2019 04:21PM
Hi JP,

a - there is an automatic synch available! Please, see the Tab "Content" of the Table! Synchronize the display (HFSQL C/S only)

b - RAD11 shows the Refresh of the Table in local procedure Refresh():

// Method called by the refresh timer
PROCEDURE Refresh()
// Stops the timer
EndTimerSys(TimerNum)

// If the user is not currently in edit
IF TableInputInProgress(Table)=False THEN
// If no modification was made by the user
// Was the file modified?
IF FileVersionNum < HVersion(KUNDEN) THEN
// Store the file version number
FileVersionNum = HVersion(KUNDEN)

// Refresh the table display
TableDisplay(Table,taCurrentSelection)

END
END

// Restart the timer
IF ManageAutoRef = True THEN
TimerNum = TimerSys("Refresh",NoRef)
END

c - Trigger refreshing the display by using a variable FOCUS and a variable like NEW_... and the the window's event "Focus gain of Table ABC:

IF FOCUS = False THEN
Iconize(""); Maximize("")
FOCUS = True
//Setze ausgewählte Zeile auf neuen Datensatz!
IF NEW_KU_NUM > 0 THEN
MyPosition = TableSeek(Table.KU_NUM,NEW_KU_NUM,True)
TableSelectPlus(Table,MyPosition)
NEW_KU_NUM = 0
END
END

Kind regards,
Guenter Predl
office@windev.at
JP
Re: [WD24] - Refresh a table control linked to a file
July 25, 2019 07:51AM
Thanks, Vassilis. Will look into that.

Cheers smiling smiley
JP
Re: [WD24] - Refresh a table control linked to a file
July 25, 2019 07:51AM
Guenter, I think that is what we need. Thank you.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: