I have a file containing phone numbers. There is one phone number in a record, and that phone number is assigned a “type”. The phone number type, PHO:PhoneType, is a byte, and is selected from a drop list with the following options:
‘Mobile|#0|Work|#1|Home|#2|Work Fax|#3|Home Fax|#4|Direct|#5|Reception|#6|After Hrs.|#7|13 Number|#8|1300 Number|#9|18 Number|#10|1800 Number|#11|Other|#12’
The phone number field, PHO:Number, is a string of 20 characters.
I have the following routine attempting (unsuccessfully) to format the displayed phone number depending on the type.
PhoneNumberFormat ROUTINE
CASE PHO:PhoneType
OF 0 ! Mobile
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P????-???-???P)
OF 1 ! Work
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 2 ! Home
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 3 ! Work Fax
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 4 ! Home Fax
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 5 ! Direct Line
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 6 ! Reception
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 7 ! After Hours
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-????-????P)
OF 8 ! 13 Number
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-??-??P)
OF 9 ! 1300 Number
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P????-???-???P)
OF 10 ! 18 Number
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P??-??-??P)
OF 11 ! 1800 Number
PHO:Number = FORMAT(DEFORMAT(PHO:Number,@S20),@P????-???-???P)
OF 12
PHO:Number = FORMAT(PHO:Number,@S20)
END
DISPLAY()
The routine is called when the PHO:PhoneType is Accepted.
It is my intention that the PHO:Number should be stored as a continuous string for sorting purposes, and that the Picture attribute is used only for display.
What I have currently is storing nothing in the PHO:Number field. I am using Clarion 9 with TPS files.
Any suggestions would be most welcome.
Thanks in advance,
Kenn Sharples