Simplicty and flexibility!


DataEase 8.2 - Variable number of Arguments added to functions (Ver. 8.2.0.1656)

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

DataEase 8.2 - Variable number of Arguments added to functions (Ver. 8.2.0.1656)

Up to this version the number of arguments a function can take has been "fixed". If the function was originally defined with 0,1,2 arguments you would always have to include them all even if you didn't need them.

As example we can use ExecDQL.

ExecDQL is defined with 6 arguments.
1. DQL itself.
2-5 Data-entry transfers to DQL.
6. Export file (CSV).

Many times you don't need the Data-entry transfers and neither the Export File but you need to include them in the code.

ExecDQL("Delete records in MyTable.","","","","","") 

Needless to say, this is a nightmare and a big source for errors as you loose count of the ""s.

From this version you can simply write: ExecDQL("delete records in MyTable.") and that is it. You can include as many of the argumetns as you want, but the order of them is pre-defined so if you want an export generated from your DQL you need to include all the empty "" for Data-Entry transfers as before.

The functions that has this feature so far is:

All ExecDQLs (ExecDQL(), MemoExecDQL(), LabelExecDQL(), FileExecDQL())
GetCurrent().
DataExport(), DataImport()

This change is "nice" when it comes to functions that has "to many" arguments, but the real important change is for functions that is defined with NO arguments at all.

Up till now we had no way of adding arguments to functions defined without them (most DFWActs was). The problem is if we added arguments the function would no longer be backwards compatible so it kind of stopped us in our tracks.

Now a function can have from 0 to N arguments so functions and it is the 0 which solves the riddle.

We can now add arguments to functions that previously had none without ruining the compatibility!!

Function to mention is: ExitDataEase() which has now gotten an optional Argument of ("Silent") which will force it to close the app without any user interaction.

Others are DataExport() which will now also be able to include a DBE designation DataExport("MyExp.DBE") as well as the original 7.x syntax of DataExport().

You will also now be able to write DataImport() without any designation.

GetCurrent() already have a "Width" and "Height" which will give you the size of the writeable main window, but we have now added object name as an optional so you can get the Width and height of any object>

GetCurrent("Widht","MyObject) and GetCurrent("Height","MyObject")

More to follow.... ;-)


Written by DataEase 11/11/14 at 17:49:16 Dataease [{8}]FIVE