The great thing about Recursion is it can adapt to change. Our phone length could change depending on the country or whether somebody enters an area code or not. So we've already added the Recursor formula to our database and we're going to review it, but let's start by looking at how it is called inside the Calculation Engine. So we'll go to Manage, Database, we'll go down to our phone field, and we've done it to phone and phone s, both of them, same thing, go into our Calculated Value and we can see we called PhoneFormat. That is now a Custom function. We've imported it and remember that FileMaker 11 can Copy and Paste or import Custom functions, you know, I didn't type it all over again from scratch, I actually imported it. So, there it is right there - PhoneFormat needs a Phone and the Format. We provide the phone using Self which means the phone here and then the format we want so it works a lot like that Plugin we saw and that's the basic idea. Works almost, you know, it's reversed from the Plugin. We had the, the Plugin has a format over here, but it's basically the same idea. We can type in anything we want here, any kind of formatting as long as we have pounds for numbers and formatting can be anything else. We're set, we can type in anything we want in here, or provide it with the Contents of Field as we'll see later. So that's it. It's very simple to call. Now let's go look at the Custom function. So again, here is your import feature and to copy and paste you use the keyboard commands, so we'll look into the PhoneFormat and the first thing we want to see is the function name and then the two parameters and then we look down at our formula. It starts off with a Case statement. Now you'll see that there's a Let function down here. You don't have to have Let function on the outside always. Sometimes you're going to have the, you know, it on the inside, it's up to you. I generally put it on the outside but it's really up to you how you do it and I want to give you an idea how it works here. Now there are two Case statements in here as you'll see. The inner Case statement decides whether we have formatting or a number, so remember, as we're going through this and we're going to put some examples up here, this might be the data, pound pound pound for the formatting -pound pound pound dash, there we go and then their phone number might be something like 909 393-4664, there we go. So the idea is that it has to look at this character here and if it's a pound that means we want to grab a number but if it's formatting we just want to grab the formatting, so that's the basic idea how this works. So let's go through it remembering that basic construct here. So what this Case statement determines is whether we should recurse or not. Eventually, as you're going through this you're going to be lopping off these formatting characters. Once you've looked at this one you're going to take it off and call it again, you know, call the Recursion again. Take another one off, call the Recursion again. So, eventually that format will be empty and when it's emptied then we're going to stop recursing and we're done formatting that phone number. So, let's take a look at the actual thing, so if it's true that there's something still in the format then we're going to run all this stuff here. There's a null result, you know, that it won't call itself again if it's, the format has something or is empty at that point. Then we have some declarations. These should be pretty familiar. We have AtNumbersOnly, it's a little bit different on the Name here, but it's the same idea, filter out all the formatting, just give us the numbers. Then we have two new ones here: AtNewFormat and AtNewNumber. Now these are very important to understand. They're used to call back to itself, and you'll see it down here and we'll explain that later but once you understand, just understand this outside of really the idea of this whole Recursion and then you can put it in place, you know, in context with the Recursion. So first don't worry about how it applies here so much. AtNewFormat says take the Left of the Format, OK that's this parameter right here and get the Length of the Format and subtract 1. It essentially removes the last character and let's see how that works. So, if we're looking at the formatting it's going to say look at the length of this formatting, which will be 12 characters, subtract 1, which is 11, then go from the left and grab 11 characters, essentially removing that last character because we're going to keep lopping off characters so the next time once we lop something off we're going to get that much and then we're going to lop another one off and then we're going to get that much and that's how we go ahead and pass back into it what we need to pass back into it. Same thing works with the AtNewNumber, just with the number values. We're going to keep passing in one less value each time we call it. Now if you understand that it's fairly easy to understand, now let's see why we need to do that when we look at the actual Recursion portion. What we do is we check here in another Case statement to see is the Right of the format a pound sign? Is it formatting? If it is, then we're going to do this part of the formula right here. We're going to say, call back to PhoneFormat and pass into it AtNewNumber, which means it'll take off 1 character and AtNewFormat which will mean it will pass in 1 less formatting character. And then we're going to concatenate on the right-most number, that's because if we found a pound it must be a number, we want to put into our stack, you know, what we're building up with this Recursion, that number. So here's the idea. It sees that it's a pound so what does it do? It uses AtNewFormat and AtNewNumber, so it lops off 1 and then in our stack we're going to get that number down there and we're going to keep going through it and keep adding to our stack and keep removing from this. So we'll go ahead and put that back in there. Put in the pound sign again. Come down here. If it's not a pound sign we're going to do something similar but a little bit different. We're going to call PhoneFormat again with AtNumbersOnly because we found some type of character here but we're not calling it with new number, we're calling it with that, we don't want to lop off a number because we found some type of formatting, that means you don't want to take that number off because we're not substituting it for the formatting, we're taking that directly from the formatting, we're directly taking this type of formatting value here or anything you might put in there. But we do pass in the new format minus 1 of those and then we say take from the format, take one to add to our stack and then we end the Let and end the Case. So let's take an idea, you know, let's work through this and see how it works. First thing it's going to go and look at, there's a pound, so it's going to go ahead and take off 1, take off 1, put that number down there. It's going to see it's a pound again, take 1 off, take 1 off, call itself again, put that number in there. Take it off, take it off, put that number there. Take it off, take it off, put the number there and this time it's going to go, oh, I have a dash. OK, I'm just going to take off the dash, add it here, but not take off the number and pass it in and you can see how it keeps building it up until this is empty and obviously when this is empty then the number will be empty. So, that's the basic idea behind this and you really should type this in to really get an idea of how this works because it'll really help you when you're typing in to really see each detail and give you a chance to really think about it rather than just copying and pasting it. But if you wanted you can always go to the Work Files to the End folder and you'll see this formula in the End file.
TERMS & CONDITIONS OF USE
BY SUBSCRIBING TO THIS SERVICE, YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT, THE TERMS AND CONDITIONS OF WHICH SHALL PREVAIL IN GOVERNING YOUR RIGHTS OF USE. BY CLICKING THE "BECOME A MEMBER" BUTTON, THE INDIVIDUAL OR ENTITY LICENSING THE PRODUCT ("YOU") IS CONSENTING TO BE BOUND BY AND IS BECOMING A PARTY TO THIS AGREEMENT. IF LICENSEE DOES NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, THE BUTTON INDICATING "BECOME A MEMBER" MUST NOT BE SELECTED, AND LICENSEE MUST NOT INSTALL OR USE THE SOFTWARE.
"VTC" refers to Virtual Training Company,
"You" refers to the user or subscriber.
"Software" refers to the VTC training content and software.
2. LICENSE: VTC hereby grants to You a worldwide, non-royalty bearing, non-exclusive license to use the Software according to the provisions contained herein and subject to payment of the applicable subscription fees.
3. RESTRICTIONS: You may not do any of the following:
Save the Software to Your hard disk or other storage
medium; permit others to use the Software except as specified by addendum;
modify, reverse engineer, decompile, or disassemble the Software; make
derivative works based on the Software; publish or otherwise disseminate
the Software. VTC, Inc., VTC Online University, and the Virtual Training
Company site is owned and operated by VTC, Inc. as a corporation of
All materials on this site are the property of VTC unless otherwise specified. No material from these pages may be copied, reproduced, republished, downloaded, uploaded, posted, transmitted, or distributed in any way. Modification of the materials or use of the materials for any other purpose is a violation of U.S. copyright law and other proprietary rights. For purposes of this Agreement, the use of any such material on any other web site or networked computer environment is prohibited.
4. FEES: The rights granted under this Agreement
are effective only upon payment of the subscription fees, which are
strictly non-refundable other than as expressly provided herein. The
term "monthly subscription" is defined as any 30 day period.
The term "yearly subscription" is defined as one 365 day
period. A yearly subscription ends on the same numerical date as it
began (example July 28, 2004 to July 28, 2005).
The VTC Online University is access to every VTC training tutorial in our library. You pay a flat fee for access to these titles. You are billed according to your renewal selection below, and can renew monthly, yearly, or in any other increment offered. If you choose to be billed monthly, you will be billed every 30 days for the subscription until you request the subscription be cancelled. Our terms of service state that you must cancel a monthly subscription at least two business days before your renewal date. These two days give us enough time to ensure that you will not be charged again.
5. LIMITED WARRANTY: VTC warrants that the Software, if operated as directed, will substantially achieve the functionality described. VTC does not warrant, however, that Your use of the Software will be uninterrupted or that the operation of the Software will be error-free or secure. In addition, the security mechanisms implemented by the Software have inherent limitations, and You must determine that the Software sufficiently meets Your requirements. VTC also warrants that the media containing the Software, if provided by VTC, is free from defects in material from the date You acquired the Software. VTC's sole liability for any breach of this warranty shall be, in VTC's sole discretion: (i) to replace Your defective media or Software; or (ii) to advise You how to achieve substantially the same functionality with the Software as described; or (iii) if the above remedies are impracticable, to refund the subscription fee You paid for the Software. Only if You inform VTC of Your problem with the Software during the applicable subscription period will VTC be obligated to honor this warranty. VTC will use reasonable commercial efforts to repair, replace, advise, or refund pursuant to the foregoing warranty within thirty (30) days of being so notified. If any modifications are made to the Software by You during the warranty period; if the medium is subjected to accident, abuse, or improper use; or if You violate the terms of this Agreement, then this warranty shall immediately terminate. This warranty shall not apply if the Software is used on or in conjunction with hardware or software other than the unmodified version of hardware and software with which the Software was designed to be used as described.
THIS IS A LIMITED WARRANTY, AND IT IS THE ONLY WARRANTY MADE BY VTC OR ITS SUPPLIERS. VTC MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTIES' RIGHTS. YOU MAY HAVE OTHER STATUTORY RIGHTS. HOWEVER, TO THE FULL EXTENT PERMITTED BY LAW, THE DURATION OF STATUTORILY REQUIRED WARRANTIES, IF ANY, SHALL BE LIMITED TO THE ABOVE LIMITED WARRANTY PERIOD. MOREOVER, IN NO EVENT WILL WARRANTIES PROVIDED BY LAW, IF ANY, APPLY UNLESS THEY ARE REQUIRED TO APPLY BY STATUTE NOTWITHSTANDING THEIR EXCLUSION BY CONTRACT. NO DEALER, AGENT, OR EMPLOYEE OF VTC IS AUTHORIZED TO MAKE ANY MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS LIMITED WARRANTY.
6. PROPRIETARY RIGHTS: VTC reserves all proprietary rights in and to the Software, is protected by copyright and other intellectual property laws and by international treaties. VTC, Inc.
Trademark Notice: VTC, Virtual Training Company,
Inc., The VTC Logo, and VTC Online University, are trademarks of VTC,
Inc. All other company and product names may be trademarks of their
The information contained herein is subject to change without notice. Copyright © 1995 - 2005 VTC, Inc. All rights reserved.
7. TERMINATION: This Agreement shall automatically terminate if You fail to comply with the restrictions described herein. Your obligations to pay outstanding subscription fees shall survive any termination of this Agreement.
8. LIMITATION OF LIABILITY: UNDER NO CIRCUMSTANCES
AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR OTHERWISE, SHALL VTC
OR ITS SUPPLIERS OR RESELLERS BE LIABLE TO YOU OR ANY OTHER PERSON
FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF
ANY CHARACTER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES. IN NO EVENT WILL VTC BE LIABLE FOR ANY
DAMAGES IN EXCESS OF THE AMOUNT VTC RECEIVED FROM YOU FOR A LICENSE
TO THE SOFTWARE, EVEN IF VTC SHALL HAVE BEEN INFORMED OF THE POSSIBILITY
DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM VTC'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
9. Links To Other Materials: Linked sites found at the VTC site are not under the control of VTC, and we are not responsible for the content of any linked site or any link contained in a linked site. VTC may change links based solely on our discretion, and we reserve the right to terminate any link or linking program at any time. VTC does not, by linking to sites, endorse companies or products to which it links and reserves the right to note as such on its web pages. If you decide to access any of the third party sites linked to this site, you do this entirely at your own risk.
Forums, and Chat are not always screened by VTC, and we are not responsible for the content of any public or open forum content at the site. VTC may change these public forums based solely on our discretion, and we reserve the right to terminate any forum at any time. VTC does not, by allowing these forums, endorse companies or products which may be mentioned in these forums, and reserves the right to note as such on its web pages. If you decide to access any of the public forums in this site, or linked to this site, you do this entirely at your own risk.
9. GOVERNING LAW & DISPUTE RESOLUTION: This Agreement is governed by Virginia law. All disputes between You and VTC shall be finally resolved through arbitration in Winchester, Virginia. This site is controlled by VTC from its offices within the United States of America. VTC makes no representation that materials in the site are appropriate or available for use in other locations, and access to them from territories where their content is illegal is prohibited. Those who choose to access this site from other locations do so on their own initiative and are responsible for compliance with applicable local laws. You may not use or export the Materials in violation of U.S. export laws and regulations. Any claim relating to the Materials shall be governed by the internal substantive laws of the Commonwealth of Virginia, USA.
VTC may revise these Terms at any time by updating this posting. You should visit this page from time to time to review the then-current Terms because they are binding on you. Certain provisions of these Terms may be superseded by expressly designated legal notices or terms located on particular pages at this Site.
If you have any questions regarding this policy,
or your information specifically,
you may email us at:email@example.com.