Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 10 of 12 total |
Sanity check |
Tue, Jul 22 2008 11:48 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | All opinions welcome
Is it worth converting the code below to SQL for use in triggers or should I stick with Delphi function FormatPhoneNumber(const Text: string): string; var Check: string; SubCheck: string; Cntr: integer; Offset: integer; PhoneStr: string; International: boolean; Sufix: string; Ignores: string; iChunk: integer; const MaxFieldLength = 25; iCodes = [20, 27, 30, 31, 32, 33, 34, 36, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 53, 54, 55, 56, 57, 58, 60, 61, 61, 62, 63, 64, 65, 66, 81, 82, 84, 86, 90, 91, 92, 93, 93, 94, 98]; begin if (Text = '') or (not (Text[1] in ['+', '0'..'9'])) then begin Result := Text; Exit; end; Ignores := GetCfgStr(cfg_IgnoreInPhone) + ' '; International := False; Offset := 0; Sufix := ''; if Text[1] = '+' then begin International := True; Offset := 1; end else if Copy(Text, 1, 2) = '00' then begin International := True; Offset := 2; end; Check := ''; for Cntr := Offset + 1 to Length(Text) do begin if (Text[Cntr] in ['0'..'9']) then Check := Check + Text[Cntr] else begin if 0 = Pos(Text[Cntr], Ignores) then begin Sufix := Copy(Text, Cntr, MaxFieldLength); Break; end; end; end; if International then begin Result := '+'; if (Check[1] = '1') or (Check[1] = '7') then iChunk := 1 else if (StrToInt(Copy(Check, 1, 2)) in iCodes) then iChunk := 2 else iChunk := 3; Result := Result + Copy(Check, 1, iChunk) + ' '; Delete(Check, 1, iChunk); Result := Result + Copy(Check, 1, 3) + ' ' + Copy(Check, 4, 3) + ' ' + Copy(Check, 7, 3) + ' ' + Copy(Check, 10, 3); if Length(Check) > 12 then Result := Result + ' ' + Copy(Check, 13, MaxFieldLength); end else begin case Check[2] of '1': begin if (StrToInt(Copy(Check, 2, 3)) in [118, 121, 131, 141, 151, 161]) then Result := Copy(Check, 1, 4) + ' ' + Copy(Check, 5, 3) + ' ' + Copy(Check, 7, 4) else Result := Copy(Check, 1, 5) + ' ' + Copy(Check, 6, 3) + ' ' + Copy(Check, 9, 3); end; '2': begin Result := Copy(Check, 1, 3) + ' ' + Copy(Check, 4, 4) + ' ' + Copy(Check, 8, 4); end; '7': begin Result := Copy(Check, 1, 2) + ' ' + Copy(Check, 3, 3) + ' ' + Copy(Check, 6, 3) + ' ' + Copy(Check, 9, 3); end; '8': begin Result := Copy(Check, 1, 4) + ' ' + Copy(Check, 5, 3) + ' ' + Copy(Check, 7, 4); end; else begin Result := Copy(Check, 1, 11); end; end; if Length(Check) > 11 then Result := Result + ' ' + Copy(Check, 12, MaxFieldLength); end; if Sufix <> '' then Result := TrimRight(TrimRight(Result) + ' ' + Sufix); end; Roy Lambert |
Tue, Jul 22 2008 11:56 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Is it worth converting the code below to SQL for use in triggers or should I stick with Delphi >> I would say that it will be *more* worth it to do so when the config-level procedures and functions are implemented, which should be 2.02. Of course, if you only need it in one database, then there's no issue. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Jul 22 2008 1:43 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>I would say that it will be *more* worth it to do so when the config-level >procedures and functions are implemented, which should be 2.02. Of course, >if you only need it in one database, then there's no issue. I was planning on leaving it until then anyway but it was more am I going to get much by coding in SQL (which I think is going to be a minor pain) rather than leaving it called from a dll. Roy Lambert |
Mon, Feb 23 2009 7:55 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>I would say that it will be *more* worth it to do so when the config-level >procedures and functions are implemented, which should be 2.02. Of course, >if you only need it in one database, then there's no issue. Just re-encountered this whilst scanning for something else. Any comments? Roy Lambert |
Mon, Feb 23 2009 9:02 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Just re-encountered this whilst scanning for something else. Any comments? >> It's in the pile for 2.03. At the very least, I'll make the config metadata changes for 2.03 so that even if the SQL is not surfaced right away, it can be in a later release. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Feb 24 2009 2:22 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Its a good job I can hold my breath a loooong time Roy Lambert |
Tue, Dec 29 2009 10:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Any news on the roadmap for this one as well? Roy Lambert |
Wed, Dec 30 2009 10:36 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Any news on the roadmap for this one as well? >> It's currently scheduled for 2.04. A bunch of config-level changes didn't make it into 2.03 due to the need to rush it a bit. All of this stuff is in a constant state of flux, unfortunately. However, the new web site design has a better layout for the roadmaps, and I'll be updating them a bit more often. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Dec 31 2009 5:37 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>It's currently scheduled for 2.04. A bunch of config-level changes didn't >make it into 2.03 due to the need to rush it a bit. All of this stuff is in >a constant state of flux, unfortunately. However, the new web site design >has a better layout for the roadmaps, and I'll be updating them a bit more >often. Good (only .02 late then . I just had a quick look at the new roadmap, is there a need for keeping the "its been done" stuff on there? My personal preference would be just to see what's coming, with possibly the other stuff in a feature list. Roy Lambert ps I also spotted the new article - if I ever recant and decide to have a go at c/s it will be VERY useful. |
Thu, Dec 31 2009 12:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< I just had a quick look at the new roadmap, is there a need for keeping the "its been done" stuff on there? My personal preference would be just to see what's coming, with possibly the other stuff in a feature list. >> I'm surfacing the release notes in the incident reports and downloads in the new web site, so yes, I can see about changing that also. << I also spotted the new article - if I ever recant and decide to have a go at c/s it will be VERY useful. >> Which one ? The "remote connections" article ? -- Tim Young Elevate Software www.elevatesoft.com |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |