Simplicty and flexibility!


Command::

case


Parameters


Returns/Result


Examples


Reference

case

Type

Procedural Command

Purpose

The case command functions like an if-then-else statement with multiple ifs. It tells DataEase to compare an expression to a series of values and execute a different action (or group of actions) based on which comparison is true.

When processing reaches a case command, DataEase compares the expression that follows the case command to each of the statements specified by the keyword value.

If the first comparison is true, DataEase executes all the actions between that value statement and the next value statement.

If the first comparison is not true, the case expression is compared to the next value statement. This comparing of values continues in top-to-bottom sequence from one value statement to the next until a true comparison is made.

If none of the specified value comparisons are true, DataEase executes the actions specified after the keyword others. If the others keyword is not present, DataEase executes none of the specified actions. It continues processing the remainder of the script.

As soon as the actions following any single statement are executed, processing passes to the first action following the end command for the case structure.

Syntax

case ( EXPRESSION) 

value COMPARISON 1 :

  ACTION SERIES 1 .

 [value COMPARISON 2 :

  ACTION SERIES 2 .]

 [value COMPARISON 3 :

  ACTION SERIES 3 .]

 [others :

  DEFAULT ACTION SERIES .]

end

 

Usage

The case command requires a case expression, at least one value statement, and an end command. Subsequent value statements, actions, and the others keyword are optional. If others is used, it must follow the last value statement.

The case expression must be enclosed in parentheses. It can be a field, a variable, or any other expression except a boolean expression (true or false). Each comparison value can be a constant, a variable, an expression, or a range of values.

An action can specify any valid procedure command including another if, while, or case command. Each nested command must be completed before processing passes to the first action after the end command (see the nested actions entry in this Lexicon).

When case commands are nested, the first end corresponds to the last preceding case, and each case command must be matched with a corresponding end command. This rule applies to all nested Procedural commands (including case, for, if, and while).

When you select case from the command pick list, DataEase automatically enters the opening ( (parenthesis).

Example

 value "FRANK" :

call menu "MAIN MENU" .

value "TOM" :

call menu "CLUB ADMINISTRATION" .

value "CAROL" :

run procedure "MAINTENANCE" .

others:

record entry "MEMBERS" .

end

 

This script tells DataEase: (1) If the current user is Frank, display the MAIN MENU document, (2) if the current user is Tom, display the CLUB ADMINISTRATION menu document, (3) if the current user is Carol, run the MAINTENANCE procedure, and (4) if the current user is anyone other than Frank, Tom, or Carol, display the MEMBERS form.

See Also


On the forum about case

Text Field will not go in (Proper) or (Upper) case

My Field Company and Town will not change to Upper case. Some fields do but a couple don't. Any fix or work around appreciated....

Product: Dataease [{8}]FIVE. Written by Dave Clements 12/12/14 at 20:03:52

Re:Text Field will not go in (Proper) or (Upper) case

Is the fields read-only or virtual and what is the derivation?...

Product: Dataease [{8}]FIVE. Written by DataEase 12/12/14 at 22:16:22

Re:Re:Text Field will not go in (Proper) or (Upper) case

Plain text field - Required and Indexed - derivation -   proper (cotown)    some other fields in the form work but at least two don't. ...

Product: Dataease [{8}]FIVE. Written by Dave Clements 12/12/14 at 22:20:46

Re:Re:Re:Text Field will not go in (Proper) or (Upper) case

Proper will only make the first letter Capital so: dAVE would be DAVE and dave would be Dave and DAVE would still be DAVE. In these cases we need to see a sample that showcase the problem as anything else would just be guessing. A...

Product: Dataease [{8}]FIVE. Written by DataEase 12/12/14 at 22:28:40

Re:Re:Re:Re:Text Field will not go in (Proper) or (Upper) case

Done all that but still doesn't work. Works on most fields but three it doesn't. ...

Product: Dataease [{8}]FIVE. Written by Dave Clements 13/12/14 at 11:22:13

Re:Re:Re:Re:Re:Text Field will not go in (Proper) or (Upper) case

OK! We love it when you guys think we are psychics but sorry, can’t do anything about it without seeing it so either you need to upload a sample that show it here, or you need to figure it out on your own ;-)...

Product: Dataease [{8}]FIVE. Written by DataEase 13/12/14 at 11:41:35

Re:Re:Re:Re:Re:Re:Text Field will not go in (Proper) or (Upper) case

Here is a screen shot, full database is very large and sample wouldn't work as some fields it works on. See company town and postcode fields. ...

Product: Dataease [{8}]FIVE. Written by Dave Clements 13/12/14 at 11:49:57

Re:Re:Re:Re:Re:Re:Re:Text Field will not go in (Proper) or (Upper) case

Thanks for that, but the problem wasn't that I didn't belive you ;-)Obviously if I try to replicate it, I don't get a problem...So if you can't send anything, then you simply need to test.Change the length of the field or somet...

Product: Dataease [{8}]FIVE. Written by DataEase 13/12/14 at 12:18:56

Application that Showcase how you can write-protect and search with paste in a Form.

Download Sample! As you all point out, this worked in DFW up to 7.2 but not in 8.x. Most likely it worked in 8.0 but somewhere along the way this was "corrected".<br...

Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 09:10:50

Re:Application that Showcase how you can write-protect and search with paste in a Form.

It's a text field, it's searching for a piece of text in a text field.&nbsp; I can type my search in a text field after choosing query start from menu/button/shortcut, why has the ability to paste a piece of text in a text field been removed??&nbsp; H...

Product: Dataease [{8}]FIVE. Written by Simon B 20/03/15 at 10:36:17

Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

"We did a lot with copy/pasting in Memo fields so it might be related to that. It is of the list of fixes, but it is a long list...

Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 11:01:22

Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

It doesn't works even on your sample database if I set prevent-entry to ON using degroup version 8.2.0.1696 or higher. If I use degroup version 8.1.0.1464 it works anyway. ...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 10/04/15 at 08:58:59

Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

The sample showcase how you can do it without setting Prevent-entry on. You do the write protect manually via SetState().If you disable the Form with SetState() it will not be disabled when in Table View or when Being In Search View....

Product: Dataease [{8}]FIVE. Written by DataEase 10/04/15 at 11:12:36

Case sensitive object names and the usefulness of RefreshForm()

Ahhh...Firstly! GR8!This feature is very under documented yet to put it mildly, so 10 points for trying it.Your version should be more than adequate for what you are trying to do but there is a couple of "traps" you need to...

Product: Dataease [{8}]FIVE. Written by DataEase 30/12/15 at 12:42:26

Re:Case sensitive object names and the usefulness of RefreshForm()

I added the RefreshForm and altered the cases of the memo&nbsp;names so that they matched exactly and it worked!The reason for my foray into this area of the software is that I need to be able to show clients&nbsp;that it is possible to bring t...

Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 30/12/15 at 14:23:03

Re:Re:Case sensitive object names and the usefulness of RefreshForm()

You can get it to work very much the same way, but you have to play a little with the Script and body.You will need to replace all Data-entry fields with the four data-entry arguments on the functions &nbsp;(data-entry field1 through data-entr...

Product: Dataease [{8}]FIVE. Written by DataEase 30/12/15 at 15:36:06

Re:Re:Re:Case sensitive object names and the usefulness of RefreshForm()

Used a &lt;pre&gt;&lt;/pre&gt; tag rather than a &lt;prev&gt;&lt;/prev&gt; tag and it is fine!...

Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 04/01/16 at 16:35:23

Re:Re:Re:Re:Case sensitive object names and the usefulness of RefreshForm()

Sorry. Dyslexia is the biggest problem for Programmers ;-)What happens when you write from the top of your head without trying to run it through the "compiler"....

Product: Dataease [{8}]FIVE. Written by DataEase 05/01/16 at 08:32:18

Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

The example doesn't works anyway (using setstate in Manip field)&nbsp;. The copy and paste doesn't work also on dataease 8.5. In any case in not a valid method because if I check "Prevent data entry" some user could be enter the data...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 04/04/16 at 12:47:14

Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Any news about this problem?...

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

Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Yes. Our team have been looking into it and it seems the bug is actually upside down.The problem is that you can paste both in Query Mode and in Edit mode so the its not a bug that you can't past in Query mode it was a bug that you could in Ed...

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

Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

OK. I'll wait a quick solution. Take in mind that I cannot install next versions of the product (included 8.5) until this problem is resolved. ...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 08:26:41

Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Just out of curiosity... What do you use this for?There is plenty of work around's for this in DataEase so why is this a showstopper?This is a "non-existing" problem to 99.99999% of our user base so I hope you understand that we need t...

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

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

OK. I understand. I decide from my side if it's useful for my company stay on the actual version or move&nbsp;forward &nbsp;with the later versions. Anyway the last working version with Copy&amp;Paste with prevent entry set to...

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

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Just to confirm the facts here.We have tested this in 6.x, 7.x etc.The pasting only works when using the mouse and right click is that correct. The pasting does not work with Keyboard shortcuts?If this is not correct, please le...

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

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

The pasting (with prevent entry set to on) doesn't works anyway is that I use the mouse or via shortcut (CNTRL-V)....

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 10:52:58

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

I am sorry but this answer didn't make it any clearer....1. We agree that this does not work in the new versions but as far as we can tell it only works when you use the mouse in older versions too. 6.52 and 7.2 etc.2. Can you use CTRL...

Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 11:30:45

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Ok we agree. The old version 6.52 and 7 the copy&amp;paste works but we don't use them anymore. We migrated 2 years ago to version 8 and copy&amp;paste worked up version 8.1.0.1464. In the later versions i tested this function and it doesn't w...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 11:54:59

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

Almost...We agree that it doesn't work at all now, but we can't get keyboard shortcut (CTRL-V) etc to work in any previous version either.It does not work in 6.52 or 7.2 either.But Mouse works in them and 8.0 and 8.1.So...

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

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

IT DOESN'T WORKS ANYWAY. If I use mouse it doesn't works. If I use CTRL-V it doesn't works. What I can do?...

Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 12:12:28

Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Re:Application that Showcase how you can write-protect and search with paste in a Form.

DOES IT WORK WITH KEYBOARD IN 8.1 AND BEFORE!!!!&nbsp;We already know that it works with Mouse but it doesn't work with keyboard in our test so we want to know if it works with KEYBOARD in 8.1 and before.We don't try to convince you th...

Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 12:21:10

Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

this is all very nice.Does it work with "any" as well? Examplefor PERSONALwith( Austritt &gt;= data-entry Field1 orAustritt = blank ) andEintritt &lt;= data-entry Field1 andFreigabe = "J"and<...

Product: Dataease [{8}]FIVE. Written by Rainer 19/03/17 at 19:44:04

Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

Of course. You ca do anything you can in "traditional" DQL and then some.It is however very awkward to include tags that [{any ERFASSUNG with ( Tag = Field1 and MANR = PERSONAL MANR ) BewegungsartNR}]So the best cause of action is simp...

Product: Dataease [{8}]FIVE. Written by DataEase 19/03/17 at 19:49:36

Re:Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

I tried to combine&nbsp;MemoExecDQL(DQL,von,"","","","Web:Default,1",Body) withretval := MemoExecDQL(any DQL with DQLnr=0003 DQL,data-entry field1,"","","","").but the output I get only the group and not the item lines. see pdf 2...

Product: Dataease [{8}]FIVE. Written by Rainer 31/03/17 at 10:49:37

Re:Re:Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

The problem is the multi-view that is generated.We base ExecDQL on the internal multiview in PRISM which is dynamic and extremly flexible.When you add a dimension you add another level.A dimention is a relational action like<br...

Product: Dataease [{8}]FIVE. Written by DataEase 31/03/17 at 14:31:11

Re:Re:Re:Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

I fire&nbsp;a "control" DQL that fire both DQLs withMemoExecDQL(DQL,von,"","","","Web:Default,1",Body)define "retval" text .retval := MemoExecDQL(any DQL with DQLnr=0003 DQL,data-entry field1,"","","","")....

Product: Dataease [{8}]FIVE. Written by Rainer 31/03/17 at 16:45:35

Re:Re:Re:Re:Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

MemoExecDQL is a function and each function is self-contained.Each of these could produce their own output. There is no "cross-over" between them and it is no voodoo or magic.When you call the MemoExecDQL it will do its job with the ar...

Product: Dataease [{8}]FIVE. Written by DataEase 31/03/17 at 17:01:26

On the blog about case

Application that Showcase how you can write-protect and search with paste in a Form.

Download Sample! In the attached sample we use SetState(), Custom Menu and Custom Toolbar to "force" the user to use our functionality correctly. Se...

Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 10:47:38

New Sample 8.5 BETAII.2 - Showcase MoveObject, Label Alignment, Transparent Fields, SetStyle() (Ver. 8.5.0.1767)

We are sorry that the link was a "dud", this has now been fixed! Download Sample <img...

Product: Dataease [{8}]FIVE. Written by DataEase 10/04/15 at 16:27:00

New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

Download Sample! Not all of us has got to grips with the concept of ExecDQL so we have taken some...

Product: Dataease [{8}]FIVE. Written by DataEase 17/03/17 at 17:09:04

Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

this is all very nice.Does it work with "any"&nbsp;as well?&nbsp;Examplefor PERSONAL with ( Austritt &gt;= data-entry Field1 or Austritt = blank ) and Eintritt &lt;= data-entry&nbsp;Field1&...

Product: Dataease [{8}]FIVE. Written by Rainer 17/03/17 at 21:12:27

Re:Re:New Sample : ExecDQL, LabelExecDQL, MemoExecDQL Showcased and explained!!!

Of course. You ca do anything you can in "traditional" DQL and then some. It is however very awkward to include tags that [{any ERFASSUNG with ( Tag = Field1 and MANR = PERSONAL MANR ) BewegungsartNR}] So the best cause of action is...

Product: Dataease [{8}]FIVE. Written by DataEase 19/03/17 at 20:31:09

New Sample: How to automatically open different external documents from DE 8.5 (Showcase)

Download Sample DataEase 8.5 is packed with new functionality but that is not much help if n...

Product: Dataease [{8}]FIVE. Written by DataEase 21/03/17 at 20:14:46


dg3_HelpView