Refresh Screen
How can I get the sub-form of a scrolled main form to refresh the rows, without using the mouse, after a new record has been added via a button and ExecDQL command. I have tried RefreshScreen(), RefreshForm(), RecordNext() + RecordPrevious(), ClearSelectionFilter() and many other combinations. All to no avail. Any Idease?
Please search this forum by "Refresh". You have several ideias and solutions for it. The best way I found is to rewrite the relational key between for / subform as follows :
OML event (
act := SetVar("temp",myvalue) .
act := SetValue("relational field name ","") .
act := SetValue("relational field name",GetVar("temp")).
or ( field's derivation)
(....) + SetVar("temp",myvalue) + SetValue("relational field name ","") + SetValue("relational field name",GetVar("temp"))
AS
Hi Afonso Santos,
Thanks for your suggestion. I have tried all the help refresh ideas. A few times.
I have tried your suggestion to refresh/change the Relational Field value both on the main form and on the sub-form. When I put it on a virtual field on the Main Form, the application GPFd. When I tried it on the button that adds the record on the sub-form, it didnt do anything. No refresh. I also tried to change/refresh one of the fields on the main form that derive the relational value but still no refresh. Thanks anyway for your help. Ill keep trying.
Hi Afonso,
Further to your suggestion, I altered the action on the Add button on the sub-form : SetVar("Temp", WkNo) + SetValue("WkNo",GetVar("Temp")+1) +SetValue("WkNo",GetVar("Temp") )
And it now works. Forcing the value in the field to did not seem to change the relationship but forcing it to acquire a different number value and then revert back to its original number did the trick.
Thanks again.
DataEase 8.5.0.2456 Released 11/08/16 have solved the problem with RefreshScreen().
All the hacks and workarounds are no longer necessary .
We are not completely sure when RefreshScreen() was introduced but most likely it has been around since the Dawn of DataDase for Windows (Express 1.0) and it has never worked.
RefreshScreen is a simple enough idea and when you think about the workarounds that have been "invented" by ingenious developers over the years one realise that this fix has been sorely missed and long awaited.
Now it is here and you can now - finally - refresh the data in your form without having to resort to witch craft.
Returning from a related form or from a pick list or whatever reason you have for refreshing the content of your form, now it is here.
Combine the Timer() with RefreshScreen() and you might be in position to deliver the next Arrivals/Departure screens for the Airports :-)