### Title

Case statement left numbers and a range

### Post

Here's what I have not sure where I am going wrong?

Left (number_contract ; 2) = ≥ 13 and ≤ 99; "Head Quarters";

Case statement left numbers and a range

Here's what I have not sure where I am going wrong?

Left (number_contract ; 2) = ≥ 13 and ≤ 99; "Head Quarters";

Question will that get rid of the issue that the case statement that I wrote keeps dropping the leading zero when saved?

Here is what I wrote but when I wrote it everything was = 01, = 02, ..... = 12

Case (Left ( number_contract ; 2) = 1; "District 1";

Left (number_contract ; 2) = 2; "District 02";

Left ( number_contract ; 2) = 3; "District 03";

Left ( number_contract ; 2) = 4; "District 04";

Left ( number_contract ; 2) = 5; "District 05";

Left ( number_contract ; 2) = 6; "District 06";

Left (number_contract ; 2) = 7; "District 07";

Left ( number_contract ; 2) = 8; "District 08";

Left ( number_contract ; 2) = 9; "District 09";

Left (number_contract ; 2) = 10; "District 10";

Left ( number_contract ; 2) = 11; "District 11";

Left ( number_contract ; 2) = 12; "District 12";

Left (number_contract ; 2) = 13; "Head Quarters";

)Isn’t the field number_contract a number field which only holds the number 1, 2, 3 etc and you want to assign the text equivalent of district (with leading zero or as headquarters) in a new calculation? Is this correct? And you want to pad the number with leading zero if less than 2 places?

Try calculation, result is text with:

Case (

number_contract ≥ 13 and number_contract ≤ 99 ; "Head Quarters" ;

"District " & Right ( "00" & number_contract ; 2 )

)BTW, Head Quarters is normally spelled Headquarters.

Try:

GetAsNumber (Left (number_contract ; 2) ) ≥ 13 and GetAsNumber (Left (number_contract ; 2) ) ≤ 99 ; ...

Which can be rewritten as:

Let ( Digits = GetAsNumber (Left (number_contract ; 2) ) ; Case ( Digits ≥ 13 and Digits ≤ 99 ) ; ...