Simplicty and flexibility!


Command::

define


Parameters


Returns/Result


Examples


Reference

define

Type

Procedural Command

Purpose

The define command is used to create a global or temporary 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 script. By specifying the variable's name, the stored value can be used like any other value in a script.

The status of a variable can be global (denoted by the keyword global) or temporary (denoted by the keyword temp). A temporary variable maintains its value only during the current script. A global variable can pass its value from one script to another when several scripts are integrated within a Control Procedure. To pass a value from one script to another, a variable must be defined identically in each script.

Syntax

define [global|temp] "VARIABLE NAME" TYPE [LENGTH] .

Usage

 

If you do not specify temp or global in the define statement, DataEase automatically creates a temporary variable.

The length specifies the number of characters for Text and Numeric String variables. The default length is 25; you can specify any length up to 255 characters. Number variables are always 14 digits long. Date and Time variables are 8 characters long. The default length is used if you do not specify a length in the define command.

 

Note: You can define a variable as any field type except Choice, Dollar, or Yes/No.

 

Example

define temp "DISCOUNT" Number .

for RESERVATIONS with TOTAL DUE > 1500 ;

assign temp DISCOUNT :=

RESERVATIONS TOTAL DUE * 0.15 .

modify records

TOTALDUE := TOTAL DUE - temp DISCOUNT .

end

 

This script tells DataEase: (1) Create (define) a temporary variable called DISCOUNT in which to store a number while processing the current script, (2) find all the RESERVATIONS records that have a value greater than 1500 in the TOTAL DUE field, (3) give (assign) the DISCOUNTvariable a value determined by multiplying the TOTAL DUE on each invoice by 15%, and (4) modify these RESERVATIONS records by subtracting the value of the DISCOUNT variable from the value in the TOTAL DUE field.

See Also


On the forum about define

How to make a button to open a predefined webside

I have DE 7.2 and want to have a button that open a predefined webside. How do I do it? Per Bruvold...

Product: DataEase for Windows 7.x. Written by Per Bruvold 01/11/12 at 07:22:37

Re:How to make a button to open a predefined webside

Hi You need to have the Custom Function ShellExecuteA loades in the Custom Defined Function. Create a button. Action: ExecuteCDF Parameters: ShellExecuteA(getfocus( ), "","www.dataease.com","",".",1) The www.dataease.com can be a derivation from a...

Product: DataEase for Windows 7.x. Written by Josef Vella 01/11/12 at 10:41:24

Re:How to make a button to open a predefined webside

Hi Per. You either get DataEase 8, where you can do all kind of Web Page/and Web enabled stuff directly in DataEase, or in lieu of that you look in the CDF sample app. You find it at the left of the Welcome screen. Over the last days, we have found that...

Product: DataEase for Windows 7.x. Written by DataEase 01/11/12 at 08:09:18

DataEase 8.5 and Define Application Printers

Hi,I noticed something while I was installing full and group versions on the same network. Here is the scenario;Installed DataEaseBeta-8.5.0.1910 on one machine. Setup all the necessary printers. Assigned printer 1 and printer 2 via...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 21/09/15 at 16:34:35

Re:DataEase 8.5 and Define Application Printers

1. There is no reason why Application Printers should be greyed out in Group. This is most likely down to the fact that there was no group when this feature was implemented so it fell under the "general" exclusion for Runtime.2. It is not a "go...

Product: Dataease [{8}]FIVE. Written by DataEase 21/09/15 at 17:42:33

Re:Re:DataEase 8.5 and Define Application Printers

Actually, I completely forgotten about this.This function is beautiful SetState("@PrinterN","PrinterName")I ca...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 21/09/15 at 22:49:56

Re:Re:Re:DataEase 8.5 and Define Application Printers

Remember that you can use GetCurrent("@DefaultPrinter") and SetState("@DefaultPrinter","PrinterName") too.This will read and set the default printer on your system so all reports without a dedicated printer will print correctly.If you w...

Product: Dataease [{8}]FIVE. Written by DataEase 22/09/15 at 14:21:06

Predefined printers on RDRRxAAA for all the users

In the RDRRxAAA.ini there's a section for the predefined printers but I have to add a section for each client in the network.There is a way to setup the same printer configuration for all the user in the network?In the example below the config...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 15/02/16 at 13:41:49

Re:Predefined printers on RDRRxAAA for all the users

This is very much close to the first feature added to the DE8.0 project and I guess that it was such a big step forwards at the time that it was left as it is (except for the GetCurrent()/SetCurrent() feature.As this is very much featured on t...

Product: Dataease [{8}]FIVE. Written by DataEase 15/02/16 at 13:58:31

Re:Re:Predefined printers on RDRRxAAA for all the users

Thanks. anyway I tried to use "setcurrent" but it seems to me that it doesn't works. I tried also in a DQL. I use DE 8.2. There's something wrong? (see figure)Anyway "Getcurrent" return to me Blank even if the printer is inserted into the ini f...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 15/02/16 at 14:55:42

Re:Re:Re:Predefined printers on RDRRxAAA for all the users

Sorry, Set/Get Application printers was first introduced in early 8.5 and then it was expanded to SetCurrent() when this function was introduced late in 8.5<a href="http://www.dataease.com/DG3_BlogList/?ParentID=0000000243&amp;field1=000000024...

Product: Dataease [{8}]FIVE. Written by DataEase 15/02/16 at 16:32:40

Re:Re:Re:Re:DataEase 8.5 and Define Application Printers

Just had the same issue and found it to be the PC Netbios name being exactly 15 characters. If the name of the PC is shortened, DataEase can correctly read and write sections into the RDR INI file to save appropriate Application Printer names. If the...

Product: Dataease [{8}]FIVE. Written by Simon Irwin 28/04/16 at 14:43:06

Re:Re:Re:Re:Re:DataEase 8.5 and Define Application Printers

Thanks Simon. I did test this today with one of my client.Changing the computer name from 16 characters to something small ......magic. Printer name stayed.Is this Simon from the U.K? Ex-Sapphire?...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 04/05/16 at 23:47:30

How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file?”

I understand that the .DBE file can be run using a CDF “Data Export” on a button action placed on the form itself. But I want to run multiple exports using defined .DBE files from a procedure. Is this possible?...

Product: Dataease [{8}]FIVE. Written by Henry Gondorf 29/06/17 at 13:23:59

Re:How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file??

Hi Henry.I think we have discussed this somewhere before, but we would never like to miss an opportunity to clarify this again.It is quite funny because in DFD you had imports but not exports, but then again you had the worlds best exp...

Product: Dataease [{8}]FIVE. Written by DataEase 29/06/17 at 14:16:29

Re:Re:How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file??

Hello Customer Care Team,How about a sample script using ExecDQL ?RegardsHenry...

Product: Dataease [{8}]FIVE. Written by Henry Gondorf 02/07/17 at 11:50:18

Re:Re:Re:How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file??

Download Sample I know we keep on harping on this but DQL is DQL, syntax wise that is true at least. ...

Product: Dataease [{8}]FIVE. Written by DataEase 02/07/17 at 11:54:20

Re:Re:Re:Re:How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file??

Thank you for your prompt reply and sample. It looks quite good and exports really fast. Well done.However, I do not see any mention of the “FORMEXP.DBE” file anywhere in the ExecDQL. Am I missing something or are you not using the dbe file an...

Product: Dataease [{8}]FIVE. Written by Henry Gondorf 03/07/17 at 17:45:02

Re:Re:Re:Re:Re:How can I use a defined Export .DBE file in a dql or script like I can with an Import .DBI file??

Downlaod Revised Sample! Hi. Sorry for the "long winded" reply. The short answer to your question...

Product: Dataease [{8}]FIVE. Written by DataEase 03/07/17 at 18:35:16

Re:Re:DataEase 8.5 and Define Application Printers

I added for my other PC the below address to define the printers on the second machine in the RDRR ini file but am I missing something as it doesn' define the printers on the second machine ??[DATAEASE64]PredefinedPrinter_1=Predef...

Product: Dataease [{8}]FIVE. Written by brent traynor 30/11/17 at 00:13:25

Re:Re:Re:DataEase 8.5 and Define Application Printers

There is one setting in RDRRxAAA.INI for each workstation that use the app.Application/Workstation printers was one of the earliest new things in DataEase 8 and has been expanded and added to since.It can be set via the Dialog in the F...

Product: Dataease [{8}]FIVE. Written by DataEase 30/11/17 at 11:05:16

Custom defined function

Can i&nbsp;create Custom defined Functions that will make calls to an API, after a successful call the received data will populate into a data-ease form?...

Product: Dataease [{8}]FIVE. Written by BLESSED SHUMBA 07/08/18 at 09:25:28

Re:Custom defined function

Hi Blessed.The best way to do this would be to use the Remote() function.This was introduced in 8.5 and will be much enhanced in 9.You can with this query any HTTP accessible API and use the data in your form.You can al...

Product: Dataease [{8}]FIVE. Written by DataEase 07/08/18 at 19:49:53

Re:Re:Custom defined function

REST API...

Product: Dataease [{8}]FIVE. Written by BLESSED SHUMBA 08/08/18 at 13:38:33

What does this message mean when I am trying to define a relationship ? How do I fix it ? Please specify the Bound Field when trying to create a Lookup Field

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by peadar Kearney 26/02/19 at 13:57:27

Re:What does this message mean when I am trying to define a relationship ? How do I fix it ? Please specify the Bound Field when trying to create a Lookup Field

Hi.&nbsp; DataEase has been managed by several different teams over the years and not all of them have been to into the lingo. I remember myself whe...

Product: Dataease [{8}]FIVE. Written by DataEase 27/02/19 at 09:42:38

Re:Re:What does this message mean when I am trying to define a relationship ? How do I fix it ? Please specify the Bound Field when trying to create a Lookup Field

Excellent.Thank you for the explanation, It is appreciated.Best Regards,Peadar...

Product: Dataease [{8}]FIVE. Written by peadar Kearney 27/02/19 at 23:19:40

predefined printer

the funktion predefined printer does only work with "print without displaying dialog". without there is not default in the printdialog...

Product: Dataease [{8}]FIVE. Written by Rainer 14/06/20 at 23:18:48

Re:predefined printer

This was actually the first feature we did in DE8.It was designed like this because it an abstraction of printers. The logic was that if you want to use a pre-defined printer it is because you want to direct the print to a specific type of pri...

Product: Dataease [{8}]FIVE. Written by DataEase 15/06/20 at 21:49:18

de8 running user defined procedures

Cannot run user defined procedures. DE8 locks up and has to be shut down with ctrl-alt-del....

Product: . Written by Roy Rudd 09/09/20 at 03:43:16

Re:de8 running user defined procedures

Hi. There is no systemic failure that prevent you from running user defined procedures. If it hangs or GPF it is most likely a corruption in your DATA.It is impossible to diagnose or help with a general request like this and one will only get...

Product: Dataease [{8}]FIVE. Written by DataEase 09/09/20 at 09:35:08

Re:Re:de8 running user defined procedures

We are using the Data files on my laptop and it works fine....

Product: Dataease [{8}]FIVE. Written by Roy Rudd 09/09/20 at 22:55:24

Re:Re:Re:de8 running user defined procedures

Is this a copy of the application that doesn't work on your system after it failed or from before it failed.I would suggest that you reverse the process and copy the files from your laptop onto your system and sees if it works then. The corrup...

Product: Dataease [{8}]FIVE. Written by DataEase 10/09/20 at 12:48:43

Setting predefined printers

Hi DataEase, I have some problem setting the predefined printers in dataease. I tried to run this DQL :define "a" text .define "b" text .define "c" text .define "d" text .a :=...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 24/08/21 at 09:47:49

Re:Setting predefined printers

Hi Marco.We have checked the problem and the problem is really GetCurrent("@PrinterN") which doesn't seem to work anymore.It turns out it didn't work in DE9 either and we will fix it there, however DE85 is no longer being updated so we...

Product: Dataease [{8}]FIVE. Written by DataEase 27/08/21 at 10:09:11

Re:Re:Setting predefined printers

Hi DataEase,On dataease reports&nbsp;I standardized the printers leaving the end user the possibility to choose a real printer (by default)&nbsp;or a spool on PDF. e.g. default = real printer ,&nbsp;printer 2 = PDFCreator , printer 3 = PDFFacto...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 27/08/21 at 10:39:00

Re:Re:Re:Setting predefined printers

There?s a way to setup the same printers for all the workstations updating manually RDRRxxxx.ini file?&nbsp;Thanks...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 21/09/21 at 07:24:09

Re:Re:Re:Re:Setting predefined printers

Hi again Marco.All this will be completely fixed in DE9 but sadly not in DE8.In DE9 you have functions for manipulating INI files as well as true Application/Workstation printers.So basically solved many times over in DE9 and n...

Product: Dataease [{8}]FIVE. Written by DataEase 21/09/21 at 10:58:55

On the blog about define


dg3_HelpView