Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

case - Begins 1

Status
Not open for further replies.

RSX02

Programmer
May 15, 2003
467
CA
Hi
I'm new with progress and I searched on the web to find how to do what I want without success.
I would like to do a case with the statement begins.
For example
Case co-num
when begins "B" then
toto = "The valueB"
when begins "C" then
toto = "The valueC"
when begins "D" then
toto = "The valueD"
end case

I know the syntax is not okay because it gives me an error.
I don't know how to solve it.
Thanks in advance
 
Define a holding variable, use the substring function to extract the left character(s) of "co-num", assign that to your holding variable, then do your case on that.
 
Here is the syntax from Progress:

SYNTAX
CASE expression :
{ WHEN value [ OR WHEN value ] ... THEN
{ block | statement }
} ...
[ OTHERWISE
{ block | statement }
]
END [ CASE ]

Code:
DEFINE VARIABLE pay-stat AS INTEGER INITIAL 1.
UPDATE pay-stat VIEW-AS RADIO-SET
    RADIO-ITEM unpaid 1 LABEL "Unpaid"
    RADIO-ITEM part 2 LABEL "Partially paid"
    RADIO-ITEM paid 3 LABEL "Paid in full".
CASE pay-stat:
    WHEN 1 THEN
        MESSAGE "This account is unpaid.".
    WHEN 2 THEN
        MESSAGE "This account is partially paid.".
    WHEN 3 THEN
        MESSAGE "This account is paid in full.".
END CASE.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top