Fred Young Posted April 6, 2010 Posted April 6, 2010 Hi! I'm using Windows 7 and Filemaker Pro 10 Advanced. I'm having a field "Phone 1". This field is for local Mobile Numbers (10 digits) As someone enters a number XXXXXXXXXX, I want it to reformat automatically to XX XXXX XXXX. What kind of calculation do I need to do... I'm brand new to calculations... Thanks for all the help I can get! /Fred
TheTominator Posted April 6, 2010 Posted April 6, 2010 (edited) The calculation you are looking for may be something like this: Case( Length(Self) = 10; Middle(Self; 1; 2) & " " & Middle(Self; 3; 4) & " " & Middle(Self; 7; 4); Self ) or even this if you want to handle a wider variety of input values consisting of 10 digits with arbitrary spacing: Let( theValue = Substitute(Self; " "; ""); Case( Length(theValue) = 10; Middle(theValue; 1; 2) & " " & Middle(theValue; 3; 4) & " " & Middle(theValue; 7; 4); Self ) ) Use this in the Auto-Enter Calculated value part of the field's definition. Uncheck the box for Do not replace existing value of field. Edited April 6, 2010 by Guest Providing two options for calculations
JerrySalem Posted April 6, 2010 Posted April 6, 2010 I would also recommend using the filter function. Let( theValue = filter (self; "1234567890"); Case( Length(theValue) = 10; Middle(theValue; 1; 2) & " " & Middle(theValue; 3; 4) & " " & Middle(theValue; 7; 4); Self ) )
LaRetta Posted April 6, 2010 Posted April 6, 2010 Hmmm, you say you are using FM Pro Advanced but your profile shows FM Pro so I'll assume you have access to creating custom functions. I would suggest using this custom function by The Shadow here. It covers all User possibilities and provides a visual format of what it should contain. If you want the format to display #### instead of underscore, check further up in the thread for another example by The Shadow where he formats with ###.
Søren Dyhr Posted April 6, 2010 Posted April 6, 2010 I believe this a bit faster: Let( theValue = Filter (Self; "1234567890"); Case(Length(theValue) = 10; Replace(Replace ( theValue ; 3 ; 0 ; " " );8;0;" "); Self ) ) --sd
Recommended Posts
This topic is 5393 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now