Easy to Create, Easy to Change - Easy to use!

Support::

global



Parameters


Returns/Result


Examples


Reference

global

Type

Keyword

Purpose

The keyword global specifies a global variable.

A variable is used to store a value such as a text string or a calculated result that can change during the processing of a procedure. By specifying the variable's name in a script, the stored value can be used like any other value.

The status of a variable can be global (denoted by the keyword global) or temporary (denoted by the keyword temp).

A temporary variable can hold a value only while processing the current script.

A global variable can pass its value from one script to another within a Control procedure. To pass a value from one script to another, a variable must be defined identically in each script.

Syntax

global VARIABLE NAME

Usage

When processing a Control procedure that links two or more Processing procedures, each global variable with the same name and type is considered the same variable and can pass its value from one Processing procedure to another.

Example

 define global "INCOME" Number .

 define global "EXPENSE S" Number .

 define global "PROFI T" Number .

 run procedure "MONTHLY TOTALS" .

 if global INCOME > global EXPENSES then

  run procedure "PAYROLL BONUS" .

 else

  run procedure "REGULAR PAYROLL" .

 end

 

This script is a Control procedure that tells DataEase: (1) Create (define) three global variables called INCOME, EXPENSES, and PROFIT to store three different numbers while processing the script, (2) run the MONTHLY TOTALS procedure. The MONTHLY TOTALS procedure (shown below) calculates the total income and expenses for the month and subtracts the latter from the former to determine the amount of profit. As each of these totals is calculated, it is assigned to the appropriately named global variable, (3) if the INCOME variable is greater than the EXPENSES variable, run the PAYROLL BONUS procedure using the value stored in the PROFIT variable to calculate each employee's bonus (a percentage of the profit based on the employee's salary level), and (4) if the INCOME variable is not greater than the EXPENSES variable, run the REGULAR PAYROLL procedure.

The MONTHLY TOTALS Processing procedure looks like this:

Example

define global "INCOME" Number .

define global "EXPENSES" Number .

define global "PROFIT" Number .

assign global INCOME := sum of RESERVATIONS

with ( DATE between 06/01/01 to 06/30/01) TOTAL DUE .

assign global EXPENSES := sum of EXPENDITURES

with ( DATE between 06/01/01 to 06/30/01) TOTAL COST . assign global PROFIT : = global INCOME - global EXPENSES .

end

 

The key feature of this example is the fact that the global variables are identically defined in the Processing procedure which calculates the value of each variable and in the Control procedure which passes these values from one Processin

See Also


On the forum about global

Problem with GetGlobal / SetGlobal functions while checking procedure .

See below  an example :....................................... .................................. ................................ ...........................

Product: Dataease [{8}]FIVE. Written by Luca 31/07/13 at 13:21:39

Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

Hmmm… This is a little headache. SetGlobal(), GetGlobal() is an internal function now not a CDF. And it is defined with “names” rather than numbers to make it more useful. SetGlobal(“MyVar”,MyValue) GetGloba...

Product: Dataease [{8}]FIVE. Written by DataEase 31/07/13 at 13:23:50

Re:Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

It's not a good idea to change how existing functions, etc, work, especially with such a commonly used function as this one.Could you not have given the internal version of this function a different name? e.g. GetVariable, or GetVar.Ther...

Product: Dataease [{8}]FIVE. Written by Adrian Jones 02/08/13 at 14:04:19

Re:Re:Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

Very good point Adrian and the time to correct it is now and the new name is GetVar()/SetVar().Luckily this is the only one, was worse when hole functionality was replaced like the Old Memo with the New memo or Lookup fields with Multi...

Product: Dataease [{8}]FIVE. Written by DataEase 02/08/13 at 14:34:42

Re:Re:Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

You can of course still use numbers and loop through them if that is what you want as DataEase automatically converts numbers to text when you use a variable, so in that use case there will be no difference....

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

Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

SetGlobal()/GetGlobal() are now renamed to SetVar() and GetVar().You can now use the old CDF and the new functions in parallel.If you have used the the new internal format for SetGlobal()/GetGlobal() you will have to rename them in your...

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

Re:Re:Re:Problem with GetGlobal / SetGlobal functions while checking procedure .

Adrian Jones wrote: "There is also an advantage to having the number, as it means you can view the currently used values with a getGlobal ( number ), or with my Looper table of integers with getGlobal ( LoopNo ). Of course, if the...

Product: Dataease [{8}]FIVE. Written by DataEase 01/10/13 at 09:16:45

Error using SetGlobal

Can anyone point out why I am getting this error message! ...

Product: Dataease [{8}]FIVE. Written by Kensington 22/10/13 at 16:22:07

Re:Error using SetGlobal

The Function is SetVar() not SetGlobal(). SetGlobal() is a CDF function that allow you to set 100 string values in memory by number. SetVar() is a built in function to transfer named variables. To retrieve value you use...

Product: Dataease [{8}]FIVE. Written by DataEase 22/10/13 at 20:14:57

Re:Re:Error using SetGlobal

I still get the same message! ...

Product: Dataease [{8}]FIVE. Written by Kensington 22/10/13 at 20:24:47

Re:Re:Re:Error using SetGlobal

Define a temp field such as:- define temp "dummy" Number . and then assign to this field the result of the SetVar:- dummy := SetVar("gcandelete","yes") . ...

Product: Dataease [{8}]FIVE. Written by Peter Birney 22/10/13 at 21:33:01

Re:Re:Re:Re:Error using SetGlobal

Sorry, still no luck. Now I am getting ...

Product: Dataease [{8}]FIVE. Written by Kensington 23/10/13 at 09:15:57

Re:Re:Re:Re:Re:Error using SetGlobal

My Guess is that you are using an early version of DE8 before we switched the names on SetGlobal() to SetVar(). Due to conflict with the old CDF. What version of DE8 are you using. General advice is to always update to the l...

Product: Dataease [{8}]FIVE. Written by DataEase 23/10/13 at 09:40:57

Re:Re:Re:Re:Re:Re:Error using SetGlobal

Below is the version I am currently using. I am going to upgrade it and post the results. ...

Product: Dataease [{8}]FIVE. Written by Kensington 23/10/13 at 10:28:28

Re:Re:Re:Re:Re:Re:Re:Error using SetGlobal

I upgraded it to 8.0.0.1375 and it now works! Thanks ...

Product: Dataease [{8}]FIVE. Written by Kensington 23/10/13 at 10:32:11

Re:Re:Re:Re:Re:Re:Re:Re:Error using SetGlobal

Also I want to add that if you are making changes then you should also update the help. The Set/GetGlobal() help is out of date and it would have saved me a lot of time if it had been updated. ...

Product: Dataease [{8}]FIVE. Written by Kensington 23/10/13 at 10:38:28

Re:Re:Re:Re:Re:Re:Re:Re:Re:Error using SetGlobal

You couldn't be more correct of course. This is an unforgivable omission and we will rectify it immediately. On the humoristic side though, the help was correct for the DataEase version you had when you started ;-) ...

Product: Dataease [{8}]FIVE. Written by DataEase 23/10/13 at 18:27:25

Global Unique Sequence Number via Remote() and DataEase Server.

Download Sample! We have just for fun created a small sample that showcase how one can have a global...

Product: Dataease [{8}]FIVE. Written by DataEase 07/07/16 at 10:26:25

On the blog about global

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

New Functions in 8 - MemoSetGlobal()+MemoGetGlobal() - Global array of memo values (8.0.0.1287)

We have now reached 19 Memo specific functions...puh!Memo has come to it's own in 8 and it is a little funny as they were so reviled in 7.Anyways...We and our 8 users have now used the different memo functions fo...

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

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

Global Unique Sequence Number via Remote() and DataEase Server. (Min 8.5.0.2222)

Download Sample! We have just for fun created a small sample that showcase how one can have a global...

Product: Dataease [{8}]FIVE. Written by DataEase 07/07/16 at 10:54:51