× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Birgitta,

Am 20.02.2024 um 06:48 schrieb Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>:

New new Version of SELECT will execute/check a condition/procedure only once
and then react on the different results:

For example:
SELECT Condition;
When-Is 'A';
//....
When-is 'B';
//...
When-in %List('X': 'Y': 'Z');
//...
Else;
//...
EndSL;

Is the same as
Select;
When Condition = 'A';
//....
When Condition = 'B';
//...
When Condition %List('X': 'Y': 'Z')
//...
Else;
//...
EndSL;

Unfortunately this might not be exactly true.

Example:

select procedureCall();
when-is ...;
when-is ...;
endsl;

Is not the same as:

select;
when procedureCall() = ...;
when procedureCall() = ...;
endsl;

In the second statement, the procedure is called for every WHEN until the compared condition is true.

In the first statement the procedure is in fact only called once, and the result is then compared to each of the WHEN-IS or WHEN-IN clauses.

So the first statement (new syntax since Spring 2023 updates) is good to check for the different results of a procedure call.

The second statement (traditional syntax) is quite good for conditional execution of different procedures - e.g. if you only want to run until one of the procedures fails.

select;
when not procedure1();
...
when not procedure2();
...
other;
...
endsl;

If the procedures return "true" (*ON) on success, this will execute the procedures until one returns "false" (*OFF) and then executes the statements in the when (e.g. clean-up).

If all procedures end successfully, the OTHER part will be executed - but not if one fails.

This type of SELECT exists since ages - and was always like that.

The first statement syntax is the result of a success RFE.

Kind regards,
Daniel

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.