fmp7 and phone script

So I found this version, which in looking over the old google posts, made me
remember from way back "Oh yeah, I thought filemaker was going to implement a
telephone mask." The below script was very similar to the one I used in fmp6, w/
two fields.

Let(Phone_Result = Filter(Phone_No; "0123456789");"(" & Left(Phone_Result; 3) &
") " & Middle(Phone_Result; 4; 3) & "-" &Right(Phone_Result; 4))

Anyways, my question is, about 90% of the numbers will be 10 digits, but there
are some that will be 5 digits to signify on-campus phone numbers. Is there a
way to have one calc that will give me a formated 10 digit if 10 digits are
entered, and a "x12345" if 5 digits are entered?
--
"... respect, all good works are not done by only good folk. For here, at the
end of all things, we shall do what needs to be done."
--till next time, Jameson Stalanthas Yu -x- <<poetry.dolphins-cove.com>>
consul [ Fr, 10 August 2007 19:16 ] [ ID #1791676 ]

Re: fmp7 and phone script

In article <f9i6h6$bsc$1 [at] gist.usc.edu>
~consul<consul [at] INVALIDdolphins-cove.com> wrote:
> So I found this version, which in looking over the old google posts,
> made me remember from way back "Oh yeah, I thought filemaker was
> going to implement a telephone mask." The below script was very
> similar to the one I used in fmp6, w/ two fields.

> Let(Phone_Result = Filter(Phone_No; "0123456789");"(" &
> Left(Phone_Result; 3) & ") " & Middle(Phone_Result; 4; 3) & "-"
> &Right(Phone_Result; 4))

> Anyways, my question is, about 90% of the numbers will be 10 digits,
> but there are some that will be 5 digits to signify on-campus phone
> numbers. Is there a way to have one calc that will give me a formated
> 10 digit if 10 digits are entered, and a "x12345" if 5 digits are
> entered?

Have you considered a Case statement?

Let ( Phone_Result = Filter ( Phone_No ; "0123456789") ;

Case (

Length ( Phone_Result ) = 10 ;
"(" & Left ( Phone_Result ; 3 ) & ") " &
Middle( Phone_Result ; 4 ; 3 ) & "-" &
Right ( Phone_Result ; 4 ) ;

Length ( Phone_Result ) = 5 ;
"x" & Phone_Result ;

"" ) )

Matt

--
Free FileMaker Technique Demos: http://www.VirtualVermont.com/FMP

My Custom Functions: http://www.briandunning.com/filemaker-custom-functions/resul ts.php?keyword=wills
Matt Wills [ Fr, 10 August 2007 19:33 ] [ ID #1791677 ]

Re: fmp7 and phone script

and thus Matt WIlls inscribed ...
> ~consul<consul [at] INVALIDdolphins-cove.com> wrote:
> Have you considered a Case statement?
> Let ( Phone_Result = Filter ( Phone_No ; "0123456789") ;
>
> Case (
>
> Length ( Phone_Result ) = 10 ;
> "(" & Left ( Phone_Result ; 3 ) & ") " &
> Middle( Phone_Result ; 4 ; 3 ) & "-" &
> Right ( Phone_Result ; 4 ) ;
>
> Length ( Phone_Result ) = 5 ;
> "x" & Phone_Result ;
>
> "" ) )


Thanks, I'll give it a try, though it looks right to me. I am pretty piss poor
at making scripts or calcs.
--
"... respect, all good works are not done by only good folk. For here, at the
end of all things, we shall do what needs to be done."
--till next time, Jameson Stalanthas Yu -x- <<poetry.dolphins-cove.com>>
consul [ Fr, 10 August 2007 20:30 ] [ ID #1791679 ]
Datenbanken » comp.databases.filemaker » fmp7 and phone script

Vorheriges Thema: Odd control/filter behavior
Nächstes Thema: xlTop10Percent