Simplicty and flexibility!


retval := SetVar("VarName",Result) .
SetVar("MyVar","Value","Global") -- 8.6 onward. Will set a Variable on the global DataEase bus.

Set any named global variable anywhere to be used anywhere in an app within the same session.

There has been several CDF libraries that has tried to tackle this need over the more than 30 years DataEase have been around, but for some strange reason DataEase itself has never seen the need for implementing this very useful and necessary feature - before now.

The CDF libraries that has offered this service have all had the weakness that they have numbered the variables and also have a limited supply of them. For instance SetArray() has only 10 and SetGlobal() only 100.

SetVar is "unlimited" and you can name them. 

One avid and long-standing user has pointed out that it was quite useful to use numbers for the variables as you could then loop through and name them automatically, but you can of course still use number or a combination of text and numbers as DataEase automatically convert between formats. See Examples below.


Variable Name: String

This is the name you want to give the variable it can be concatenated like this concat("MyVar",Counter) or you can use a date, number etc.

Value: String

The value you want to put into the global variable. It can be anything and it will be automatically converted to string, and converted back when read by GetVar()

[Option: String]

Option is GLOBAL which will allow you to set a variable on the shared DataEase bus. This means you can share global variables between the DataEase applications on the same computer/user.


Nothing. This is the standard for most new functions so they can be added in chains without impacting the result.


Example 1

SetVar("MyStyle",GetStyle("MyButton") -- This will read the stylename of button my button and put it in the Global variable MyStyle.

You can now reset the button to original style by using: 

Example 2

Define "counter" number .
Define "Retval" text .

For MyForm ;
Retval := SetVar(concat("MyVar",Counter),CustomerName) .

List records

CustomerName .

This example will generate a numbered variable for each customerName, but it would maybe be better to use for instance CustomerNr as the name for the variable.

Define "counter" number .

Define "Retval" text .

For MyForm ;
Retval := SetVar(CustomerNr,CustomerName) .

List records

CustomerName in order ;
CustomerNr .

You will now be able to retrieve the value of the Global variable by referncing with the CustomerNr.


As part of the DataEase for Windows restoration project we have come to a big omission in DataEase - Global Variables or transfer of information between processes if you like.

It amazes us how many wishes, needs and wants from almost every user, that has been blatantly ignored by "us". We have had no qualms in brushing off desperate user with a CDF or a receipt long as your arm to "fix" a problem in our product.

In DataEase 8 we have deemed to remedy a lot of these omissions. It might be too late for a lot of users, but that excuse is getting to old too. When we took over development we were told that yes LegEasy DOS is how it should have been done back in 1994 but alas, now it was too late. We can't hide behind "too late". It is only too late if we think that DataEase will ever be used by people that have already used it, but our goal is to get it to be used by people that have never used it too.

Just because there is some CDF's that can transfer a limited number of variables, and there is an SQL return code that one can use for the same, doesn't mean that the problem is solved. Especially not when we are going to tell you all to not use DQL body for printing.

What? Not using DQL body for printing, not using DQL for printing? No! It doesn't work, and it never have. It is the achilles heel of DataEase for Windows and a couple of hours working with it is enough to kill the spirit of the bravest.

DQL without Printing is both effective and amazing, but the way the body has been implemented is just backwards.

I can guarantee you that nobody that make a living from using DataEase use the DQL body for anything. So if you are a new user, don't even try.

The fact that the Data-Entry form is as limited doesn't make the situation any better.

Use DQL for processing, and use Report for printing! End of story!

The only reason we use DQL for printing is that that is what we used to do in DFD, and the reason we used to do that in DFD is because we need to have a data-entry form.

In DataEase 8, we have introduced Virtual Editable Field so you can make a DataEntry form as a normal for with relationships etc. Then you use the new SetGlobal("Variablename",Value) to set the global variables either in a virtual field or directly on the button that Fire the Report. In the report you set the Filter and use GetGloal("Variablename") and the job is done.

With Set/GetVar() you can have as many global variables as you like and you can give them descriptive names.

You can of course use them for anything you like, the above is just an example.


See Also

On the forum about SetVar


Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien. le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46


Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 รจ poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40


Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about SetVar