Phone number formating

Here's my take on this problem, using Progress ABL, external .p file so that it could be run from various data directives. There are a lot of tables with phone numbers!

/*
Procedure FormatPhone.p - Given phone string 1234567890[x123...], validate and return it formatted.
Usage:
run FormatPhone.p (INPUT vcphone, OUTPUT vcPhone2) NO-ERROR.
if error-status:error then do:
/* error handling code, message to user, etc. */
end.
*/
def input param vcPhone as char no-undo.
def output param vcPhone2 as char no-undo.

def var vcExt as char no-undo.
def var vdTemp as decimal no-undo.
def var vcbad as char no-undo.
def var delim as char no-undo.
def var badchars as char no-undo initial "-().". /* add others if needed but leave "X" to delimit the extension */
def var i as int no-undo.

do i = 1 to length(badchars):
vcBad = substring(badchars, i, 1).
vcphone = replace(vcPhone, vcBad, "").
end.

if length(vcPhone) > 10 then do:
/* multiple character delim didn't work, convert to "x" */
if index(vcPhone, "Extension") > 0 then vcPHone = replace(vcPhone, "Extension", "x").
else if index(vcPhone, "Ext") > 0 then vcPhone = replace(vcPhone, "Ext", "x").
else if index(vcPhone, "Ex") > 0 then vcPhone = replace(vcPhone, "Ex", "x").

if index(vcPhone, "x") > 0 then delim = "x".

if delim > ""
then assign
vcExt = trim(entry(2, vcPhone, delim))
vcPhone = trim(entry(1, vcPhone, delim))
vcExt = replace(vcExt, ".", "")
vcPhone = replace(vcPhone, Delim, ""). /* strip out the "X" */

end.

if vcPhone > "" and length(vcPhone) <> 10 then return error "Phone# must be 10 numeric digits".

assign vdTemp = DECIMAL(vcPhone) no-error.
if error-status:error then do: /* not an integer */
return error "Non-numeric digits in phone number: " + vcPhone.
end.
else do:
vcPhone2 = string(vcPhone,"(999)999-9999") + (if vcExt > "" then "x" + vcExt else "").
end.

Thanks!

Christopher Heins
Sr. Progress Programmer/Analyst
[cid:image001.png@01CC2F36.1A6D6C60]
Cell# 908-256-3662
cheins@...<mailto:cheins@...>


________________________________

NOT INTENDED AS A SUBSTITUTE FOR A WRITING

NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO, SHALL CONSTITUTE A BINDING CONTRACT, OR ANY CONTRACTUAL OBLIGATION BY PNY, OR ANY INTENT TO ENTER INTO ANY BINDING OBLIGATIONS, NOTWITHSTANDING ANY ENACTMENT OF THE UNIFORM ELECTRONIC TRANSACTIONS ACT, THE FEDERAL E-SIGN ACT, OR ANY OTHER STATE OR FEDERAL LAW OF SIMILAR SUBSTANCE OR EFFECT. THIS EMAIL MESSAGE, ITS CONTENTS AND ATTACHMENTS ARE NOT INTENDED TO REPRESENT AN OFFER OR ACCEPTANCE OF AN OFFER TO ENTER INTO A CONTRACT. NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO SHALL ALTER THIS DISCLAIMER.
This e-mail message from PNY Technologies, Inc. is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
______________________________________________________________


[Non-text portions of this message have been removed]
Can anyone tell me? Would having a phone number auto format be a function of a customization or a BPM post process? OR Either?! Does anyone out there have this already built that I can just take the code and drop it into place? I'm not sure how to go about this. Suggestions?
Depends on where you want it... a Report,,, its a report, If you want it on
the UI and its on a String field it could be BPM or Customization.

*Jose C Gomez*
*Software Engineer*
*
*
*checkout my new blog <http://www.usdoingstuff.com> *
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*



On Fri, Jun 17, 2011 at 12:42 PM, jgiese1988 <jgiese@...
> wrote:

> **
>
>
> Can anyone tell me? Would having a phone number auto format be a function
> of a customization or a BPM post process? OR Either?! Does anyone out there
> have this already built that I can just take the code and drop it into
> place? I'm not sure how to go about this. Suggestions?
>
>
>


- Open in Google Docs Viewer
- Open link in new tab
- Open link in new window
- Open link in new incognito window
-
- Download file
- Copy link address
- Edit PDF File on PDFescape.com


[Non-text portions of this message have been removed]
It'd probably be best to do it through a data directive BPM so it hits EVERY time no matter where the data is updated from.

As for actual syntax...hopefully someone can help with that, I could likely figure it out with a few hours....but I'm sure for something of this magnitude others are much more proficient.

Ken

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of jgiese1988
Sent: Friday, June 17, 2011 10:42 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Phone number formating



Can anyone tell me? Would having a phone number auto format be a function of a customization or a BPM post process? OR Either?! Does anyone out there have this already built that I can just take the code and drop it into place? I'm not sure how to go about this. Suggestions?



[Non-text portions of this message have been removed]
I am looking to use this function at the customer entry and contact entry forms at a minimum. I too felt this might be a BPM thing more than a Customization, but I have no idea where to begin to make that happen with ABL. Otherwise running on 9.05.604a we can attach a .NET script to a BPM does that sound appropriate?

Josh G

--- In vantage@yahoogroups.com, Ken Williams <kwilliams@...> wrote:
>
> It'd probably be best to do it through a data directive BPM so it hits EVERY time no matter where the data is updated from.
>
> As for actual syntax...hopefully someone can help with that, I could likely figure it out with a few hours....but I'm sure for something of this magnitude others are much more proficient.
>
> Ken
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of jgiese1988
> Sent: Friday, June 17, 2011 10:42 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Phone number formating
>
>
>
> Can anyone tell me? Would having a phone number auto format be a function of a customization or a BPM post process? OR Either?! Does anyone out there have this already built that I can just take the code and drop it into place? I'm not sure how to go about this. Suggestions?
>
>
>
> [Non-text portions of this message have been removed]
>
.NET BPMs are a pain. Even if you know c# better than ABL, the hassle tends
to outweigh the benefit.

Do all your phone numbers have the same number of digits? If so, let me know
and I'll gin you up some ABL to do the trick.


On Fri, Jun 17, 2011 at 1:40 PM, jgiese1988
<jgiese@...>wrote:

> **
>
>
> I am looking to use this function at the customer entry and contact entry
> forms at a minimum. I too felt this might be a BPM thing more than a
> Customization, but I have no idea where to begin to make that happen with
> ABL. Otherwise running on 9.05.604a we can attach a .NET script to a BPM
> does that sound appropriate?
>
> Josh G
>
>
> --- In vantage@yahoogroups.com, Ken Williams <kwilliams@...> wrote:
> >
> > It'd probably be best to do it through a data directive BPM so it hits
> EVERY time no matter where the data is updated from.
> >
> > As for actual syntax...hopefully someone can help with that, I could
> likely figure it out with a few hours....but I'm sure for something of this
> magnitude others are much more proficient.
> >
> > Ken
> >
> > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> Of jgiese1988
> > Sent: Friday, June 17, 2011 10:42 AM
> > To: vantage@yahoogroups.com
> > Subject: [Vantage] Phone number formating
> >
> >
> >
> > Can anyone tell me? Would having a phone number auto format be a function
> of a customization or a BPM post process? OR Either?! Does anyone out there
> have this already built that I can just take the code and drop it into
> place? I'm not sure how to go about this. Suggestions?
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>



--
*Waffqle Driggers*
*High End Dev, System Design, Profit Drinking
*
*:: 904.962.2887*
*:: waffqle@...*
*:: NO FAXES*

*

*


[Non-text portions of this message have been removed]
Waffqle I appreciate the input on the .NET scene ha ha. We really only deal with customers in the US and Canada. As long as it can format (xxx) xxx-xxxx in 10 digit that should be fine. I am excited to see this as I have had a hard time finding examples and resources for ABL.

Josh G

--- In vantage@yahoogroups.com, Waffqle <waffqle@...> wrote:
>
> .NET BPMs are a pain. Even if you know c# better than ABL, the hassle tends
> to outweigh the benefit.
>
> Do all your phone numbers have the same number of digits? If so, let me know
> and I'll gin you up some ABL to do the trick.
>
>
> On Fri, Jun 17, 2011 at 1:40 PM, jgiese1988
> <jgiese@...>wrote:
>
> > **
> >
> >
> > I am looking to use this function at the customer entry and contact entry
> > forms at a minimum. I too felt this might be a BPM thing more than a
> > Customization, but I have no idea where to begin to make that happen with
> > ABL. Otherwise running on 9.05.604a we can attach a .NET script to a BPM
> > does that sound appropriate?
> >
> > Josh G
> >
> >
> > --- In vantage@yahoogroups.com, Ken Williams <kwilliams@> wrote:
> > >
> > > It'd probably be best to do it through a data directive BPM so it hits
> > EVERY time no matter where the data is updated from.
> > >
> > > As for actual syntax...hopefully someone can help with that, I could
> > likely figure it out with a few hours....but I'm sure for something of this
> > magnitude others are much more proficient.
> > >
> > > Ken
> > >
> > > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
> > Of jgiese1988
> > > Sent: Friday, June 17, 2011 10:42 AM
> > > To: vantage@yahoogroups.com
> > > Subject: [Vantage] Phone number formating
> > >
> > >
> > >
> > > Can anyone tell me? Would having a phone number auto format be a function
> > of a customization or a BPM post process? OR Either?! Does anyone out there
> > have this already built that I can just take the code and drop it into
> > place? I'm not sure how to go about this. Suggestions?
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
> >
>
>
>
> --
> *Waffqle Driggers*
> *High End Dev, System Design, Profit Drinking
> *
> *:: 904.962.2887*
> *:: waffqle@...*
> *:: NO FAXES*
>
> *
>
> *
>
>
> [Non-text portions of this message have been removed]
>
Happy to help! And in case you aren't familiar already, .NET is great
for customization and such. It's only really a pain in BPM land.

What do your numbers look like now? Is there whitespace and extraneous
characters, are there only digits or is it some mix?

On Fri, Jun 17, 2011 at 1:54 PM, jgiese1988
<jgiese@...>wrote:

> **
>
>
> Waffqle I appreciate the input on the .NET scene ha ha. We really only deal
> with customers in the US and Canada. As long as it can format (xxx) xxx-xxxx
> in 10 digit that should be fine. I am excited to see this as I have had a
> hard time finding examples and resources for ABL.
>
> Josh G
>
>
> --- In vantage@yahoogroups.com, Waffqle <waffqle@...> wrote:
> >
> > .NET BPMs are a pain. Even if you know c# better than ABL, the hassle
> tends
> > to outweigh the benefit.
> >
> > Do all your phone numbers have the same number of digits? If so, let me
> know
> > and I'll gin you up some ABL to do the trick.
> >
> >
> > On Fri, Jun 17, 2011 at 1:40 PM, jgiese1988
> > <jgiese@...>wrote:
>
> >
> > > **
> > >
> > >
> > > I am looking to use this function at the customer entry and contact
> entry
> > > forms at a minimum. I too felt this might be a BPM thing more than a
> > > Customization, but I have no idea where to begin to make that happen
> with
> > > ABL. Otherwise running on 9.05.604a we can attach a .NET script to a
> BPM
> > > does that sound appropriate?
> > >
> > > Josh G
> > >
> > >
> > > --- In vantage@yahoogroups.com, Ken Williams <kwilliams@> wrote:
> > > >
> > > > It'd probably be best to do it through a data directive BPM so it
> hits
> > > EVERY time no matter where the data is updated from.
> > > >
> > > > As for actual syntax...hopefully someone can help with that, I could
> > > likely figure it out with a few hours....but I'm sure for something of
> this
> > > magnitude others are much more proficient.
> > > >
> > > > Ken
> > > >
> > > > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On
> Behalf
> > > Of jgiese1988
> > > > Sent: Friday, June 17, 2011 10:42 AM
> > > > To: vantage@yahoogroups.com
> > > > Subject: [Vantage] Phone number formating
> > > >
> > > >
> > > >
> > > > Can anyone tell me? Would having a phone number auto format be a
> function
> > > of a customization or a BPM post process? OR Either?! Does anyone out
> there
> > > have this already built that I can just take the code and drop it into
> > > place? I'm not sure how to go about this. Suggestions?
> > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > *Waffqle Driggers*
>
> > *High End Dev, System Design, Profit Drinking
> > *
> > *:: 904.962.2887*
> > *:: waffqle@...*
> > *:: NO FAXES*
> >
> > *
>
> >
> > *
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>



--
*Waffqle Driggers*
*High End Dev, System Design, Profit Drinking
*
*:: 904.962.2887*
*:: waffqle@...*
*:: NO FAXES*

*

*


[Non-text portions of this message have been removed]
I use regular expressions in customization - once you write have it just paste it to other customizations. You can google to find them written by others for editing almost anything. Remember you need the following Import:
Imports System.Text.RegularExpressions ' needed for editing

Code I cut from our Customer Customization - I warn the user if it seems to be invalid for USA or Canada since I didn't edit for the other countries.

Private Sub Customer_AfterFieldChange(ByVal sender As Object, ByVal args As DataColumnChangeEventArgs)
'** Argument Properties and Uses **
'args.Row("[FieldName]")
'args.Column, args.ProposedValue, args.Row
'Add Event Handler Code

'If args.ProposedValue <> "" Then
Select Case args.Column.ColumnName

Case "EMailAddress"
If emailAddressCheck(args.ProposedValue) = False Then MessageBox.Show("Email Address may no be valid","ICC Custom Edit")
Case "PhoneNum"
If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Phone Number is not valid for USA or Canada","ICC Custom Edit")
Case "FaxNum"
If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Fax Number is not valid for USA or Canada","ICC Custom Edit")
Case "Zip"
If PostalCodeCheck(args.ProposedValue) = False Then MessageBox.Show("Postal Code is not valid for USA or Canada","ICC Custom Edit")
Case "BTPhoneNum"
If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Phone Number is not valid for USA or Canada","ICC Custom Edit")
Case "BTFaxNum"
If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Fax Number is not valid for USA or Canada","ICC Custom Edit")
Case "BTZip"
If PostalCodeCheck(args.ProposedValue) = False Then MessageBox.Show("Bill TO Postal Code is not valid for USA or Canada","ICC Custom Edit")
Case "State"
If StateCodeCheck(args.ProposedValue) = False Then MessageBox.Show("State code is not a valid State or Canadian Providence CoDe","Icc Custom Edit")
Case Else

End Select
'End If

End Sub

Function EmailAddressCheck(ByVal emailAddress As String) As Boolean

Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
If emailAddressMatch.Success Then
EmailAddressCheck = True
Else
EmailAddressCheck = False
End If

End Function

Function PhoneNumberCheck(ByVal Phone As String) As Boolean

Dim pattern As String = "^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$"
Dim PhoneNumberMatch As Match = Regex.Match(Phone, pattern)
If PhoneNumberMatch.Success Then
PhoneNumberCheck = True
Else
PhoneNumberCheck = False
End If

End Function

Function PostalCodeCheck(ByVal Postal As String) As Boolean

Dim pattern As String = "[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d|\d{5}(?(?=-)-\d{4})"
Dim PostalCodeMatch as Match = Regex.Match(Postal, pattern)

If PostalCodeMatch.Success Then
PostalCodeCheck = True
Else
PostalCodeCheck = False
End If

End Function

Function StateCodeCheck(ByVal Statecode As String) As Boolean

Dim pattern As String = "^(?-i:AB|BC|MB|N[BLTSU]|ON|PE|QC|SK|YT)$" 'Canadian Prov
Dim pattern2 As String = "^(?-i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"
Dim StateCodeMatch As Match = Regex.Match(Statecode, pattern)
If Not StateCodeMatch.Success Then StateCodeMatch = Regex.Match(Statecode, pattern2)

If StateCodeMatch.Success Then
StateCodeCheck = True
Else
StateCodeCheck = False
End If

End Function

Function UPSAcctCheck(ByVal UPSAcct As String) As Boolean

Dim pattern As String = "^([a-z0-9A-Z]{6})$" '6 digits or characters

Dim UPSAcctMatch As Match = Regex.Match(UPSAcct, pattern)
If UPSAcctMatch.Success and Len (UPSAcct) = 6 Then
UPSAcctCheck = True
Else
UPSAcctCheck = False
End If
End Function


--- In vantage@yahoogroups.com, Waffqle <waffqle@...> wrote:
>
> Happy to help! And in case you aren't familiar already, .NET is great
> for customization and such. It's only really a pain in BPM land.
>
> What do your numbers look like now? Is there whitespace and extraneous
> characters, are there only digits or is it some mix?
>
> On Fri, Jun 17, 2011 at 1:54 PM, jgiese1988
> <jgiese@...>wrote:
>
> > **
> >
> >
> > Waffqle I appreciate the input on the .NET scene ha ha. We really only deal
> > with customers in the US and Canada. As long as it can format (xxx) xxx-xxxx
> > in 10 digit that should be fine. I am excited to see this as I have had a
> > hard time finding examples and resources for ABL.
> >
> > Josh G
> >
> >
> > --- In vantage@yahoogroups.com, Waffqle <waffqle@> wrote:
> > >
> > > .NET BPMs are a pain. Even if you know c# better than ABL, the hassle
> > tends
> > > to outweigh the benefit.
> > >
> > > Do all your phone numbers have the same number of digits? If so, let me
> > know
> > > and I'll gin you up some ABL to do the trick.
> > >
> > >
> > > On Fri, Jun 17, 2011 at 1:40 PM, jgiese1988
> > > <jgiese@>wrote:
> >
> > >
> > > > **
> > > >
> > > >
> > > > I am looking to use this function at the customer entry and contact
> > entry
> > > > forms at a minimum. I too felt this might be a BPM thing more than a
> > > > Customization, but I have no idea where to begin to make that happen
> > with
> > > > ABL. Otherwise running on 9.05.604a we can attach a .NET script to a
> > BPM
> > > > does that sound appropriate?
> > > >
> > > > Josh G
> > > >
> > > >
> > > > --- In vantage@yahoogroups.com, Ken Williams <kwilliams@> wrote:
> > > > >
> > > > > It'd probably be best to do it through a data directive BPM so it
> > hits
> > > > EVERY time no matter where the data is updated from.
> > > > >
> > > > > As for actual syntax...hopefully someone can help with that, I could
> > > > likely figure it out with a few hours....but I'm sure for something of
> > this
> > > > magnitude others are much more proficient.
> > > > >
> > > > > Ken
> > > > >
> > > > > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On
> > Behalf
> > > > Of jgiese1988
> > > > > Sent: Friday, June 17, 2011 10:42 AM
> > > > > To: vantage@yahoogroups.com
> > > > > Subject: [Vantage] Phone number formating
> > > > >
> > > > >
> > > > >
> > > > > Can anyone tell me? Would having a phone number auto format be a
> > function
> > > > of a customization or a BPM post process? OR Either?! Does anyone out
> > there
> > > > have this already built that I can just take the code and drop it into
> > > > place? I'm not sure how to go about this. Suggestions?
> > > > >
> > > > >
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > *Waffqle Driggers*
> >
> > > *High End Dev, System Design, Profit Drinking
> > > *
> > > *:: 904.962.2887*
> > > *:: waffqle@*
> > > *:: NO FAXES*
> > >
> > > *
> >
> > >
> > > *
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
> >
>
>
>
> --
> *Waffqle Driggers*
> *High End Dev, System Design, Profit Drinking
> *
> *:: 904.962.2887*
> *:: waffqle@...*
> *:: NO FAXES*
>
> *
>
> *
>
>
> [Non-text portions of this message have been removed]
>
Wow that's a solid list of functions. It might take me a bit to filter this and get it put in and understand it, but it is nice to have something to work with. Thank you very much.

Josh G.

--- In vantage@yahoogroups.com, "Dan Sirow" <dansirow@...> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
> I use regular expressions in customization - once you write have it just paste it to other customizations. You can google to find them written by others for editing almost anything. Remember you need the following Import:
> Imports System.Text.RegularExpressions ' needed for editing
>
> Code I cut from our Customer Customization - I warn the user if it seems to be invalid for USA or Canada since I didn't edit for the other countries.
>
> Private Sub Customer_AfterFieldChange(ByVal sender As Object, ByVal args As DataColumnChangeEventArgs)
> '** Argument Properties and Uses **
> 'args.Row("[FieldName]")
> 'args.Column, args.ProposedValue, args.Row
> 'Add Event Handler Code
>
> 'If args.ProposedValue <> "" Then
> Select Case args.Column.ColumnName
>
> Case "EMailAddress"
> If emailAddressCheck(args.ProposedValue) = False Then MessageBox.Show("Email Address may no be valid","ICC Custom Edit")
> Case "PhoneNum"
> If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Phone Number is not valid for USA or Canada","ICC Custom Edit")
> Case "FaxNum"
> If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Fax Number is not valid for USA or Canada","ICC Custom Edit")
> Case "Zip"
> If PostalCodeCheck(args.ProposedValue) = False Then MessageBox.Show("Postal Code is not valid for USA or Canada","ICC Custom Edit")
> Case "BTPhoneNum"
> If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Phone Number is not valid for USA or Canada","ICC Custom Edit")
> Case "BTFaxNum"
> If PhoneNumberCheck(args.ProposedValue) = False Then MessageBox.Show("Fax Number is not valid for USA or Canada","ICC Custom Edit")
> Case "BTZip"
> If PostalCodeCheck(args.ProposedValue) = False Then MessageBox.Show("Bill TO Postal Code is not valid for USA or Canada","ICC Custom Edit")
> Case "State"
> If StateCodeCheck(args.ProposedValue) = False Then MessageBox.Show("State code is not a valid State or Canadian Providence CoDe","Icc Custom Edit")
> Case Else
>
> End Select
> 'End If
>
> End Sub
>
> Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
>
> Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
> Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
> If emailAddressMatch.Success Then
> EmailAddressCheck = True
> Else
> EmailAddressCheck = False
> End If
>
> End Function
>
> Function PhoneNumberCheck(ByVal Phone As String) As Boolean
>
> Dim pattern As String = "^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$"
> Dim PhoneNumberMatch As Match = Regex.Match(Phone, pattern)
> If PhoneNumberMatch.Success Then
> PhoneNumberCheck = True
> Else
> PhoneNumberCheck = False
> End If
>
> End Function
>
> Function PostalCodeCheck(ByVal Postal As String) As Boolean
>
> Dim pattern As String = "[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d|\d{5}(?(?=-)-\d{4})"
> Dim PostalCodeMatch as Match = Regex.Match(Postal, pattern)
>
> If PostalCodeMatch.Success Then
> PostalCodeCheck = True
> Else
> PostalCodeCheck = False
> End If
>
> End Function
>
> Function StateCodeCheck(ByVal Statecode As String) As Boolean
>
> Dim pattern As String = "^(?-i:AB|BC|MB|N[BLTSU]|ON|PE|QC|SK|YT)$" 'Canadian Prov
> Dim pattern2 As String = "^(?-i:A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"
> Dim StateCodeMatch As Match = Regex.Match(Statecode, pattern)
> If Not StateCodeMatch.Success Then StateCodeMatch = Regex.Match(Statecode, pattern2)
>
> If StateCodeMatch.Success Then
> StateCodeCheck = True
> Else
> StateCodeCheck = False
> End If
>
> End Function
>
> Function UPSAcctCheck(ByVal UPSAcct As String) As Boolean
>
> Dim pattern As String = "^([a-z0-9A-Z]{6})$" '6 digits or characters
>
> Dim UPSAcctMatch As Match = Regex.Match(UPSAcct, pattern)
> If UPSAcctMatch.Success and Len (UPSAcct) = 6 Then
> UPSAcctCheck = True
> Else
> UPSAcctCheck = False
> End If
> End Function
>
>
> --- In vantage@yahoogroups.com, Waffqle <waffqle@> wrote:
> >
> > Happy to help! And in case you aren't familiar already, .NET is great
> > for customization and such. It's only really a pain in BPM land.
> >
> > What do your numbers look like now? Is there whitespace and extraneous
> > characters, are there only digits or is it some mix?
> >
> > On Fri, Jun 17, 2011 at 1:54 PM, jgiese1988
> > <jgiese@>wrote:
> >
> > > **
> > >
> > >
> > > Waffqle I appreciate the input on the .NET scene ha ha. We really only deal
> > > with customers in the US and Canada. As long as it can format (xxx) xxx-xxxx
> > > in 10 digit that should be fine. I am excited to see this as I have had a
> > > hard time finding examples and resources for ABL.
> > >
> > > Josh G
> > >
> > >
> > > --- In vantage@yahoogroups.com, Waffqle <waffqle@> wrote:
> > > >
> > > > .NET BPMs are a pain. Even if you know c# better than ABL, the hassle
> > > tends
> > > > to outweigh the benefit.
> > > >
> > > > Do all your phone numbers have the same number of digits? If so, let me
> > > know
> > > > and I'll gin you up some ABL to do the trick.
> > > >
> > > >
> > > > On Fri, Jun 17, 2011 at 1:40 PM, jgiese1988
> > > > <jgiese@>wrote:
> > >
> > > >
> > > > > **
> > > > >
> > > > >
> > > > > I am looking to use this function at the customer entry and contact
> > > entry
> > > > > forms at a minimum. I too felt this might be a BPM thing more than a
> > > > > Customization, but I have no idea where to begin to make that happen
> > > with
> > > > > ABL. Otherwise running on 9.05.604a we can attach a .NET script to a
> > > BPM
> > > > > does that sound appropriate?
> > > > >
> > > > > Josh G
> > > > >
> > > > >
> > > > > --- In vantage@yahoogroups.com, Ken Williams <kwilliams@> wrote:
> > > > > >
> > > > > > It'd probably be best to do it through a data directive BPM so it
> > > hits
> > > > > EVERY time no matter where the data is updated from.
> > > > > >
> > > > > > As for actual syntax...hopefully someone can help with that, I could
> > > > > likely figure it out with a few hours....but I'm sure for something of
> > > this
> > > > > magnitude others are much more proficient.
> > > > > >
> > > > > > Ken
> > > > > >
> > > > > > From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On
> > > Behalf
> > > > > Of jgiese1988
> > > > > > Sent: Friday, June 17, 2011 10:42 AM
> > > > > > To: vantage@yahoogroups.com
> > > > > > Subject: [Vantage] Phone number formating
> > > > > >
> > > > > >
> > > > > >
> > > > > > Can anyone tell me? Would having a phone number auto format be a
> > > function
> > > > > of a customization or a BPM post process? OR Either?! Does anyone out
> > > there
> > > > > have this already built that I can just take the code and drop it into
> > > > > place? I'm not sure how to go about this. Suggestions?
> > > > > >
> > > > > >
> > > > > >
> > > > > > [Non-text portions of this message have been removed]
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > *Waffqle Driggers*
> > >
> > > > *High End Dev, System Design, Profit Drinking
> > > > *
> > > > *:: 904.962.2887*
> > > > *:: waffqle@*
> > > > *:: NO FAXES*
> > > >
> > > > *
> > >
> > > >
> > > > *
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > *Waffqle Driggers*
> > *High End Dev, System Design, Profit Drinking
> > *
> > *:: 904.962.2887*
> > *:: waffqle@*
> > *:: NO FAXES*
> >
> > *
> >
> > *
> >
> >
> > [Non-text portions of this message have been removed]
> >
>