Simplicty and flexibility!


Function::Internal

GetVar
GetVar(TEXT VALUE)
GetVar("My Variable")
GetVar("CustomerName")
GetVar("InvoiceTotal")
GetVar("SystemDate")
GetVar("MyVariable,"Global") -- 8.6 onwards. Will get variable from shared DataEase BUS.


Together with SetVarl() to allow users to transfer any number of values from any one part of the application to any other part of the application.

It will allow the user to name the variable and retrieve it by using the same name. GetVarl() and SetVarl() will automatically translate all DataEase Data types, so you can transfer Text, Numbers, Numerical Strings, Choices, Dates, Time etc.

Parameters


TEXT VALUE

The Name of the variable that you want to retried.

[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.

Returns/Result


Text Value that is converted to the field type of the field from which the function is called.

Examples


Example 1

We want to use a certain value a lot of places, for instance the customers discount but we can't be bothered to set up a relationship between all tables.

Somewhere we call the function:

SetVar("UserDiscount",DiscountField)


Everywhere else we can then call.

GetVar("UserDiscount") 

It will then always return the values set for UserDiscount until the session is ended or a new value is set with SetGlobal()

Example 2

You can also create dynamic global variables by creating dynamic names.

Somewhere we call the function:

SetVar(concat(current user name,current date),DiscountField)


Everywhere else we can then call.

GetVar(concat(current user name,current date)) 

It will then always return the values set for UserDiscount until the session is ended or a new value is set with SetVar()

Example 3

One major usage for SetVarl() and GetVarl() is to improve filtering and Data-Entry for reporting etc.

It is no secret that DQL printing "stinks" and it is no better in 8. It will be better with DataEase 8 Reporter, but the way that "hard core" DataEase developers have gotten around this is by using Reports instead of DQL for printing.

The way you will do that is simply to set the Data-Entry values as Global variables and then you use GetVar() directly in the selection filter.

The Filter variable you simply set on the action for the button that executes the rapport from you form.

DocumentOpen( "MyQuickReport")+SetVar("MyCustomerName",CustomerName)


This way you can Run Reports directly to print without having to deal with the awkward DQL printing. 

Reference

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.

Bull...it. 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 SetVarl("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/GetVarl() 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


SetVar
MemoSetGlobal
MemoGetGlobal

On the forum about GetVar

SetVar()/GetVar() and Strings in <=8.5 vs >=8.6

Funny you ask the question just now.The limit is and has been for any string in DataEase 255 from 1.0 through to 8.5We have a function that is MemoSetGlobal() and MemoGetGlobal() but the limitation on that is that you need a memo to be...

Product: Dataease [{8}]FIVE. Written by DataEase 12/11/17 at 13:26:21

On the blog about GetVar

New Functions in 8 - SetVar()+GetVar() - Time to take control!

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,...

Product: Dataease [{8}]FIVE. Written by DataEase 02/11/12 at 20:25:35

New Function(s) in 8 - SetVar()/GetVarl() - Internal function from (Ver 8.0.0.1172)

SetVar() and GetGlobal() is fully implemented in DataEase 8 from version build 1172.Format: SetVar("Variablename","Value") where both parameters are string. Returns Empty String.Format: GetVar("Variablename") where parameter is string. R...

Product: Dataease [{8}]FIVE. Written by DataEase 29/11/12 at 15:51:17

New Function(s) in 8 - SetVar() and GetVar(), set and read named global variables (Ver 8.0.0.1176)

These two functions have been partly implemented for a while, but due to structural changes in PRISM we had to disable them in release. These changes have now been made and they are free to use.It is more than 30 years since DataEase 1.0 was re...

Product: Dataease [{8}]FIVE. Written by DataEase 04/12/12 at 10:06:48

DO NOT USE! SetGlobal()+GetGlobal(). (Will be renamed to SetVar()+GetVar())

We admit that we mad a bad judgement call when we named our new Global Variable functions SetGlobal() and GetGlobal()There is a CDF with the same functions that has been widely used for years, and migration old apps will then have problems...

Product: Dataease [{8}]FIVE. Written by DataEase 02/08/13 at 11:35:53

New Release - DataEase 8.0.0.1358 - Important Change! Set/GetGlobal() changed to Set/GetVar()

We have now changed SetGlobal() and GetGlobal() internal function to SetVar() and GetVar().If you have used our internal SetGlobal()/GetGlobal() function you will need to change your code to reflect the function name changes.We have ch...

Product: Dataease [{8}]FIVE. Written by DataEase 05/08/13 at 13:35:17

Update to Sample CRM (NoOffice) due to change from Set/GetGlobal() to Set/GetVar()

Download Update!As we use these functions quite extensively in this sample you will need to update your sample if you have downloaded DE8 prior to 8.0.0.1360.We a...

Product: Dataease [{8}]FIVE. Written by DataEase 05/08/13 at 16:07:03

Re:Update to Sample CRM (NoOffice) due to change from Set/GetGlobal() to Set/GetVar()

what is the user name and password to access this sample database...

Product: Dataease [{8}]FIVE. Written by luis conde 13/08/13 at 17:47:57

Re:Re:Update to Sample CRM (NoOffice) due to change from Set/GetGlobal() to Set/GetVar()

email and email for normal userhigh and high to access to the catalogue (Developer Mode)...

Product: Dataease [{8}]FIVE. Written by DG3 Development 14/08/13 at 20:57:13

Re:DO NOT USE! SetGlobal() GetGlobal(). (Will be renamed to SetVar() GetVar())

Can't you remove this in DE8 Native ?...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 14/08/13 at 21:03:12

Enable/Disable based on Global variable using SetStyle(),SetState(),SetVar(),GetVar(),MoveObject()

Download Sample! We got a request from a user on how to control the users...

Product: . Written by DataEase 25/09/15 at 08:54:32


dg3_HelpView