Simplicty and flexibility!


DataEase 8.5 - AutoRefresh Form and other nifty tricks (8.5.0.1918)

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

DataEase 8.5 - AutoRefresh Form and other nifty tricks (8.5.0.1918)

Download Sample!

We guess this is a good opportunity to show an alternative method to OpenRelated() with better developer control, and also how to manage your own updating etc.

In this sample we basically use SetVar()/GetVar() to transfere statuses between forms and use SelectionFilter() to enforce the relationship rather than OpenRelated().

OpenRelated() is a good quick way for drill down in Data but it as most "ready made" functionalities it also comes with its clear limitations.

So here we create our own.

Look at the MouseOver event on Record1 on Maindata and also look at the statuses we set and reset.

Here we basically check "every" time the mouse move if GetVar("New") is set and if it is, we re-set the filter which then re-load all the data and the subform.

When the "subform" form is closing the mouse will move from that to the main form and this will be counted as mouse move so the Subform and all the data will be updated before the form is re-drawn i.e. you won't be able to see it.

As we don't want the form to redraw all the time we reset "New" and it will do nothing till next time.




On the Open button we have this simple action.

It basically transfere the maindata ID and the Subform ID for current record. We will use this in the Subform when opened as form.

When we open the Subform the Manip Virtual field will calculate with the following derivation:




Here we basically check if we want the subform to search up the correct record or not. We base that on two criteria, SubSearch set and RecordID set. If either is blank, we will assume it is a new record.

As we need to preseve the relationship the MainID will be set to the transferred ID.

We are now ready to fill it in.

You can see that we Reset SubSearch and New "whatever", because we don't want the Subform to try to search again, and we want the MainForm to refresh whatever happens when we return.

The sharp observer will also see something "strange".

We set a variable called CloseScript to a rather "complex" content....

Why?

To show you that you the strength of ExecDQL and to show you how you can very simply enforce or direct different behaviour simply by transferring the script, rather than a long if statement on the button itself.

Here we transfer a "simple" little DQL that just execute some actions. We basically just change the script based on the form being edited or not.

Not edited, we simply allow you to close it. If it has been edited you can Save and close it.

We complete the "illusion" by changing the text and style of the button.


Written by DataEase 26/11/15 at 11:15:46 Dataease [{8}]FIVE

Re:DataEase 8.5 - AutoRefresh Form and other nifty tricks (8.5.0.1918)

Sample updated to 8.5.1 version. Will not work in previous versions of DataEase 8.x


Written by DataEase 13/04/16 at 16:58:20 Dataease [{8}]FIVE
DG3_BlogList