![]() | |
#11
| |||||
| |||||
|
|
I think there is a reasonable standard, namely AreaCode FourDigits FourDigits for fixed phones and 4 digits 3 digits digits for mobile phones. for example 02 9123 4567 (8 digits or 10 digits) |
|
and 0413 422 431 (10 digits) for cell / mobile phones. |
|
The problem is with the various ways human beans can muck up a simple system. |
|
I think 04 is restricted to mobile phones. So why not: |
|
And then, using a VOIP phone and an autodial modem, you could try automatically dialling each number to see whether it is still valid. If it rings once, OK, otherwise mark it as a dud. |
#12
| |||
| |||
|
|
All the phone numbers are in one text field? I envy you! |
|
I've seen users who use 2nd address lines for phone numbers for no other reason than "That's were I like to put 'em". ( I wish to heavens I was joking here.) |
#13
| |||
| |||
|
|
Hey Leslie, Here is a way to do it: ;----------------- method cmReplaceStringContent(strToCorrectString string, strToReplace string, strReplaceWith string) string var strBGN, strEND string endvar try if strToCorrectString.advMatch("^(..)" + strToReplace + "(..)$", strBGN, strEND) then return cmReplaceStringContent(strBGN, strToReplace, strReplaceWith) + strReplaceWith + cmReplaceStringContent(strEND, strToReplace, strReplaceWith) else return strToCorrectString endif onfail errorclear() return strToCorrectString endtry endMethod ;------------------------ ;Example: method pushButton(var eventInfo Event) var arToStrip Array[] string strInput string strResult string liLoop longint endvar try ;TESTING INPUT STRING: strInput = "L !@es `l*(i ~9{8%5_&e M<>?,2)8./-i l$b|=[]u = 3^r 5+}\\8#n" ;characters to strip"~`!@#$%^&*()_+-=[]{}\\|;:'\",./<>? " ;initialize strResult = "" ;optional arToStrip.empty() ;fill the array with characters to strip ;arToStrip.addLast("~") ; this character first stripped before "for" loop ;special opal characters preceed with "\\" arToStrip.addLast("`") arToStrip.addLast("!") arToStrip.addLast("\\@") arToStrip.addLast("#") arToStrip.addLast("\\$") arToStrip.addLast("%") arToStrip.addLast("\\^") arToStrip.addLast("&") arToStrip.addLast("\\*") arToStrip.addLast("\\(") arToStrip.addLast("\\)") arToStrip.addLast("_") arToStrip.addLast("\\+") arToStrip.addLast("-") arToStrip.addLast("=") arToStrip.addLast("\\[") arToStrip.addLast("\\]") arToStrip.addLast("{") arToStrip.addLast("}") arToStrip.addLast("\\\\") arToStrip.addLast("\\|") arToStrip.addLast(";") arToStrip.addLast(":") arToStrip.addLast("'") arToStrip.addLast(chr(34)) ;"\\"" or chr(34) arToStrip.addLast(",") arToStrip.addLast(".") arToStrip.addLast("/") arToStrip.addLast("<") arToStrip.addLast(">") arToStrip.addLast("\\?") arToStrip.addLast(chr(32)) ;space ;first input the strInput strResult = cmReplaceStringContent(strInput, chr(126), "") ;~ ;loop through the rest of the string to strip further with characters from the array for liLoop from 1 to arToStrip.size() strResult = cmReplaceStringContent(strResult, arToStrip[liLoop], "") endfor strResult.view() ;result = Lesli985eM28ilbu3r58n onfail errorclear() endtry endMethod ;-------------- Jan |
#14
| |||
| |||
|
|
Hi Robert, Answers inline.... "Robert Molyneux" wrote... I think there is a reasonable standard, namely AreaCode FourDigits FourDigits for fixed phones and 4 digits 3 digits digits for mobile phones. for example 02 9123 4567 (8 digits or 10 digits) well most people use (02) 9123 4567 and of course there are legacy phone numbers like (046) 123 5678 and 0413 422 431 (10 digits) for cell / mobile phones. Some people use 041 342 2431 believe it or not !! Of course you will have noticed we are slowly getting the American style of nos such as 123-TAXI. The problem is with the various ways human beans can muck up a simple system. Couldn't agree more. Last year I contacted the relevant government body to suggest they might like to consider a standard but it appears that it is all too hard (Just like my quest to get banks to become Ebay friendly allowing for 2 plus digit Item Nos for deposits - also too hard). I guess the frustration is that computers have been around forever and still it feels like the dark ages. I think 04 is restricted to mobile phones. So why not: It was a good suggestion but this is not my data to mess around with so changing the values is a no-no. Basically, we have decided to get rid of most of our composite secondary keys and create a Index table - basically de-normalising the data but the beauty is that we can format these fields however we want and for phone numbers it will be Alphanumeric only which is good enough for a ..123.. QBE for example. And then, using a VOIP phone and an autodial modem, you could try automatically dialling each number to see whether it is still valid. If it rings once, OK, otherwise mark it as a dud. Well given that quite a few of my customers are in the bush they are lucky to have a working landline let alone mobiel and forget ADSL. Leslie. |
#15
| |||
| |||
|
|
We are trying to achieve a method to search via phone number including a partial match, and thats the problem. |
#16
| |||
| |||
|
|
No matter what format it is, why not create another field to host a fully stripped phone number? When searching, strip the search criteria similarly and search the fully stripped field instead of the loosely formatted one. |
#17
| |||
| |||
|
|
And so we return to the original question of how to remove punctuation (or any sequence of characters) from a field via an SQL query. |
#18
| |||
| |||
|
|
I don't see how you'd do it with Local SQL. Other dialects could, but not Local SQL. Load it into MySQL or Firebird or OracleXE. |
![]() |
| Thread Tools | |
| Display Modes | |
| |