Simplicty and flexibility!


DataEase 8.2 - GetCurrent() updated! "RowNumber", "RecordNumber", "Version" (Ver. 8.2.0.1607)

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

DataEase 8.2 - GetCurrent() updated! "RowNumber", "RecordNumber", "Version" (Ver. 8.2.0.1607)

Download Simple Sample

GetCurrent() is the addition to the old and trusted Current from DFD. We have decided to add it as a function rather than continue on the built in command since functions are more flexible and modern. "Everything" we add to DE8 is basically through the function interface now for this reason.

GetCurrent("RowNumber") was actullay added way back, but for some reason we have forgotten to update the documentation and write about it. 

In DE8 we have added a lot of functions that can manipulate screen objects. SetState(), SetValue(), SetLabelText(), GetValue() etc... And to use these functions in a normal form where the object name is unique is simple. Simply use the objectname in "" and you have designated the object.

SetState("MyButton",0) will hide the object called MyButton.

But when you start working with multirecord objects like Subforms you hit a brick wall. In OML you can manipulate the active object, but there is no way to manipulate an object on the same Record other than next , previous etc... The problem with Multi-record objects like Subforms is that they are clones.

If you have a subform with fields CustometrNr, CustomerName etc. and you have 20 rows in the subform you will have 20 objects named CustomerNr and 20 objects called CustomerName (If you have CustonerNr and CustomerName in main form record to you will have 21 and this is why renaming a column in a subform to a differnt name OBJECTNAME is such a good idea (now you understand why there is a different objectname if you wondered why fields have two names)). To work around this problem with the 20 objects with the same name, we have added # denotation to all Set/Get functions that use objects.

SetState("MyButton#10",0) will hide the MyButton in the 10th row in the subform.

So far all is good, but how does an object know which row it is in if it want's to manipulate itself or any other object in the same row?

It wont. Not until GetCurrent("RowNumber"). This function will return the active row the object is on when it is computed/refreshed. So if you scoll down, it will change. So a derivation in a virtual field like: SetStyle(concat("MyButton#",GetCurrent("RowNumber")),"Default") will always change the style of the object in the same record called MyButton, when you scroll up and down. 

GetCurrent("RecordNumber") - Same goes for this function as the previous one, but the difference is that this function returns the place in the RecordNumber in the multiview (cursor) that currently is populating a form/subform. If your search has yielded a retun of 1000 records the first record will have the value 1 and the last one 1000.

GetCurrent("Version") - This is a function that is desperately needed! We develop DataEase 8.x the same way we think/believe you develop a DataEase application. Evolutionary. As you can read from this blog, we constantly add new functions and functionalities. 

We could put in a versioning system so you could never "downgrade" i.e. use a DE 8.2.0.1607 app with a lower version of DE8 but it would cause unnecessary problems for people that has developed in the latest version without using any of the new features and then deploy to a lower version.

So instead of forcing this, we include this function so the developer can themselves keep track of the version needed to run their app, and then give a warning on startup if the version the customer runs is too low.


Written by DataEase 21/08/14 at 12:10:10 Dataease [{8}]FIVE