I’m converting some old code from Filemaker to Servoy. There is an age calculation for past due accounts that uses a Case Statement. Example:
Case(Days_Old_Calc < 30;0;(Days_Old_Calc ≥ 30) and (Days_Old_Calc < 60);1;(Days_Old_Calc ≥ 60) and (Days_Old_Calc < 90);2;(Days_Old_Calc ≥ 90) and (Days_Old_Calc < 120);3;Days_Old_Calc ≥ 120;4)
I figured I’d use a Switch Statement in Servoy, but am having trouble structuring the statement. I’ve read some other posts where people are wanting the same result for multiple cases. Example:
switch(x){
case ‘a’: code1;
break;
case ‘b’: code2;
break;
case ‘c’: code1;
break;
}
The suggestion:
switch(x) {
case ‘a’:
case ‘c’:
code 1;
break;
case ‘b’: code 2;
break;
}
I could write out several cases to cover all days from 0-29, 30-59, and so on, but what about days greater than 120? Maybe a switch statement isn’t the proper thing to use here. Thanks in advance for the help!