Re: Normalizing Dates and Phone numbers

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 26729
interpreted = N
texte = >At 9:26 PM -0800 2000/01/29, Chuck Rice wrote: > >>At 5:00 PM -1000 2000/01/29, Kenneth Grome wrote: >> >>>Here, use this database with the convertchars context. It will get rid of everything that's not a number, then you can format the resulting string of digits with some getchars contexts ... or you can leave the resulting string as it is, which will result in 4085551212 based on your examples above: >> >>Thanks! Here is what I came up with. Seems to handle most cases. -Chuck- >> >>[!] >>[\!][GetChars start=8&end=10&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars]-[!] >>[\!][GetChars start=5&end=7&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars]-[!] >>[\!][GetChars start=1&end=4&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars] > >Ok, Now I am confused again. The above works for output, but I need to process the >input from a field before it gets written to the database. > >I put the above code in an include file called -NormalizePhone and set it up so I could invoke it with: > > [include file=-NormalizePhone&var1=[HPhone]] > >My input field is in a form Which then invokes a completion routine that has: > >[showif [action]=Replace] > >[replace db=AddressBook.db&eqSKUdatarq=[url][sku][/url]] [!] >[\!][formvariables name=_&exact=F][getchars start=2][name][/getchars]=[url][value][/url]&[/formvariables] [!] >[\!][/replace] > >
Record Replaced

> >[commitdatabase db=AddressBook.db] >[/showif] > >In it. Where do I put the include to change the phone number? It seems to be in the formvariables. That use of the formvariables context is a shortcut that sends all the formvariables beginning with _ to the replace context to be replaced directly, without any preprocessing.If you want to process the phone number value *before* putting it into the database, you have to write a different replace context -- one that replaces each field individually. Try using something like this on the page following your form:[text]strippedPhoneValue=[ConvertChars db=Strip.db][phoneFieldFromForm][/ConvertChars][/text][text]finalPhoneValue=[GetChars start=8&end=10&from=end][strippedPhoneValue][/GetChars]-[GetChars start=5&end=7&from=end][strippedPhoneValue][/GetChars]-[GetChars start=1&end=4&from=end][strippedPhoneValue][/GetChars][/text][replace]field1=[url][formField1][/url]& ... &phone=[url][finalPhoneValue][/url]&field99=[url][formField99][/url][/replace]================================ Kenneth Grome, WebDNA Consultant 808-737-6499, http://webdna.net ================================------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Associated Messages, from the most recent to the oldest:

    
  1. Re: Normalizing Dates and Phone numbers (Chuck Rice 2000)
  2. Re: Normalizing Dates and Phone numbers (Kenneth Grome 2000)
  3. Re: Normalizing Dates and Phone numbers (Chuck Rice 2000)
  4. Re: Normalizing Dates and Phone numbers (Chuck Rice 2000)
  5. Re: Normalizing Dates and Phone numbers (Kenneth Grome 2000)
  6. Re: Normalizing Dates and Phone numbers (Aaron Lynch 2000)
  7. Normalizing Dates and Phone numbers (Chuck Rice 2000)
>At 9:26 PM -0800 2000/01/29, Chuck Rice wrote: > >>At 5:00 PM -1000 2000/01/29, Kenneth Grome wrote: >> >>>Here, use this database with the convertchars context. It will get rid of everything that's not a number, then you can format the resulting string of digits with some getchars contexts ... or you can leave the resulting string as it is, which will result in 4085551212 based on your examples above: >> >>Thanks! Here is what I came up with. Seems to handle most cases. -Chuck- >> >>[!] >>[\!][GetChars start=8&end=10&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars]-[!] >>[\!][GetChars start=5&end=7&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars]-[!] >>[\!][GetChars start=1&end=4&from=end]00000000000[ConvertChars db=Strip.db][var1][/ConvertChars][/GetChars] > >Ok, Now I am confused again. The above works for output, but I need to process the >input from a field before it gets written to the database. > >I put the above code in an include file called -NormalizePhone and set it up so I could invoke it with: > > [include file=-NormalizePhone&var1=[HPhone]] > >My input field is in a form Which then invokes a completion routine that has: > >[showif [action]=Replace] > >[replace db=AddressBook.db&eqSKUdatarq=[url][sku][/url]] [!] >[\!][formvariables name=_&exact=F][getchars start=2][name][/getchars]=[url][value][/url]&[/formvariables] [!] >[\!][/replace] > >
Record Replaced

> >[commitdatabase db=AddressBook.db] >[/showif] > >In it. Where do I put the include to change the phone number? It seems to be in the formvariables. That use of the formvariables context is a shortcut that sends all the formvariables beginning with _ to the replace context to be replaced directly, without any preprocessing.If you want to process the phone number value *before* putting it into the database, you have to write a different replace context -- one that replaces each field individually. Try using something like this on the page following your form:[text]strippedPhoneValue=[ConvertChars db=Strip.db][phoneFieldFromForm][/ConvertChars][/text][text]finalPhoneValue=[GetChars start=8&end=10&from=end][strippedPhoneValue][/GetChars]-[GetChars start=5&end=7&from=end][strippedPhoneValue][/GetChars]-[GetChars start=1&end=4&from=end][strippedPhoneValue][/GetChars][/text][replace]field1=[url][formField1][/url]& ... &phone=[url][finalPhoneValue][/url]&field99=[url][formField99][/url][/replace]================================ Kenneth Grome, WebDNA Consultant 808-737-6499, http://webdna.net ================================------------------------------------------------------------- Brought to you by CommuniGate Pro - The Buzz Word Compliant Messaging Server. To end your Mail problems go to .This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Kenneth Grome

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Problems with [Search] param - Mac Plugin b15 (1997) case sensitivity in lookups (1997) Here's how to kill a Butler Database. (1997) [WebDNA] POST method using TCPSend (2013) dos bug? (1999) Satistics (1999) Version f1 status (1997) access denied problem (1997) WebCat2: Master Counter snippet (1997) Sample Tearoom Search Error (1997) ShowNext Context (2004) Adding up weights (1998) WebCat2b15MacPlugin - showing [math] (1997) Associative lookup style? + bit more (1997) multi-paragraph fields (1997) Uploading Files and Descriptions W* (2000) NT vs Mac (1997) Sorting search results (1998) WebCat2b13MacPlugIn - [include] (1997) 2.0.1 new commands and contexts (1997)