validating an ABN

199 views
Skip to first unread message

Stephen M

unread,
Apr 9, 2007, 12:00:53 AM4/9/07
to cfaussie
So, has anyone got a Cold Fusion ABN validator they can throw me?

I've found a PHP one, but no luck so far searching for one in CF.

So far, what I've come up with is

Len(ABN) eq 11

which is a bit like Blackadder and Baldrick's s rewrite of Dr.
Johnson's dictionary, stuck on Aardvark

Steve Onnis

unread,
Apr 9, 2007, 12:02:54 AM4/9/07
to cfau...@googlegroups.com
What does the PHP one do? I wouldn't have thought there would have been a
squence or formula to creating an ABN number, not like a credit card anyway.

Andrew Muller

unread,
Apr 9, 2007, 2:38:58 AM4/9/07
to cfau...@googlegroups.com
How about using a webservice instead:

http://www.abn.business.gov.au/ABRXMLSearch/


-------------------------------------------------------------------
Andrew Muller
http://www.webqem.com

linkedin: http://www.linkedin.com/pub/1/151/905

Simon Haddon

unread,
Apr 9, 2007, 4:58:22 AM4/9/07
to cfau...@googlegroups.com
Hi,

I did this in an excel spreadsheet years ago.  Initially followed the instructions on the ATO website but found they were slightly wrong.

So after a little mucking around and validations against known ABN's I came up with a formula that works. (Which is only slightly different to what the ATO said anyway).

Rather than explaining it here I would say just look at the spreadsheet.  The top 1/2 shows how to generate an ABN from an ACN and the 2nd 1/2 validates an ABN.

The only things that I ask is that you create a CFC that is open source and credits me with doing the initial ground work.  Oh and make the CFC available to everyone as I am sure there are ppl out there with the same problems.

The other good thing is that it would be easy to implelement into Javascript too.

Cheers,
Simon Haddon
si...@sibern.com.au
http://www.sibern.com.au


On 09/04/07, Stephen M <sgmu...@gmail.com> wrote:



--
Cheers
Simon Haddon
ABN.xls

Mark Stanton

unread,
Apr 9, 2007, 6:15:50 AM4/9/07
to cfau...@googlegroups.com
> How about using a webservice instead:
>
> http://www.abn.business.gov.au/ABRXMLSearch/

Why bother using an authoritative source when you can spend hours
trying to reverse engineer the business rules and invent your own
method of validation instead?

On 4/9/07, Andrew Muller <andrew...@gmail.com> wrote:
>

>
>
>
> On 09/04/07, Stephen M <sgmu...@gmail.com> wrote:
> >
> > So, has anyone got a Cold Fusion ABN validator they can throw me?
> >
> > I've found a PHP one, but no luck so far searching for one in CF.
> >
> > So far, what I've come up with is
> >
> > Len(ABN) eq 11
> >
> > which is a bit like Blackadder and Baldrick's s rewrite of Dr.
> > Johnson's dictionary, stuck on Aardvark
> >
> >
> > >
> >
>
>
> -------------------------------------------------------------------
> Andrew Muller
> http://www.webqem.com
>
> linkedin: http://www.linkedin.com/pub/1/151/905
>
> >
>


--
Mark Stanton
Gruden Pty Ltd
http://www.gruden.com

Simon Haddon

unread,
Apr 9, 2007, 6:33:38 AM4/9/07
to cfau...@googlegroups.com
Simply cause you might want to use a cfc instead of a web service call.  There could be a variety of reasons for that approach.  Also, once the business rules are worked out you could also implement in Javascript as well.

Then again you could use ajax with the below mentioned web service in conjunction with server side validation.  To be honest I don't care how Stephen implements it.  Iwas just trying to help

Cheers,
Simon
--
Cheers
Simon Haddon

Rod Higgins

unread,
Apr 9, 2007, 8:13:46 AM4/9/07
to cfau...@googlegroups.com
Why bother making a comment like that when it adds no value whatsoever to
the discussion? There are a multitude of reasons why a webservice may not
either be allowed, be possible or even be preferred to be used.

Thanks for the input Simon I've always wondered how an ABN was generated.

-----Original Message-----
From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf

Simon Haddon

unread,
Apr 9, 2007, 8:22:32 AM4/9/07
to cfau...@googlegroups.com
Hi Rod,

The comment was cause I misrad the emails and thought that Mark was making a comment about my ABN excel spreadsheet.  Confusion set in after a long weekend

Cheers,
Simon
--
Cheers
Simon Haddon

Mark Stanton

unread,
Apr 9, 2007, 8:58:34 AM4/9/07
to cfau...@googlegroups.com
Guys I'm not commenting on any specific code or spreadsheet - I'm
talking about how you are approaching the problem.

On the one hand you have a method that will give you a yes or no
answer that is guaranteed to be correct. On the other hand you roll
your own approach that will at best give you something along the lines
of "I'm really not sure but that looks kinda right".

Yes, there are some cases where a web service or HTTP GET are not
applicable, but unless you have specific reasons that stops you, the
ABR web service is the better choice.

ABRWebServiceGateway.cfc

Simon Haddon

unread,
Apr 9, 2007, 9:05:32 AM4/9/07
to cfau...@googlegroups.com
I can say that my method which follows the ATO rules except for their one mistake (which they have probably corrected by now) is correct and was used to assist the ACT Government during the changeover from ACN to ABN.  It is not happhazard .  It has been verified as correct

Cheers,
Simon

On 09/04/07, Mark Stanton <mark.s...@gmail.com> wrote:

Andrew Scott

unread,
Apr 9, 2007, 11:31:39 AM4/9/07
to cfau...@googlegroups.com
lol,
 
But Mark ABN's can still be valid and no longer be in use any more, so the webservice would be the best option..... Unless of course you where being sarcastic :-)
--



Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

Simon Haddon

unread,
Apr 9, 2007, 5:04:05 PM4/9/07
to cfau...@googlegroups.com
That is one thing that the web service can do that standard validations can't do.  I was trying to help with the original request made by Stephen.  The web service has the advantage of giving back other information too.  Like company name, history, etc. 

Not all applications can call web services however.  Sometimes there are wierd firwall rules in place.  Especially in Government departments.  I know that the web server that I deploy my latest application on cannot make http requests going out.  Really sucks but is proving a major headache to change and will likely take years at our current rate of negotiations.  Therefor the reason to have a CFC.
--
Cheers
Simon Haddon

Simon Haddon

unread,
Apr 9, 2007, 5:04:36 PM4/9/07
to cfau...@googlegroups.com
Oh.  I was not trying to be sarcastic at any time.  I was just trying to help
--
Cheers
Simon Haddon

Stephen M

unread,
Apr 9, 2007, 7:01:46 PM4/9/07
to cfaussie
I'm thinking that the best idea would be to do both, first validate
the number then submit to the web service. The web service will
probably be slow at times, so you wouldn't want to waste time
submitting a typo.

My approach is to validate, ask the user to check that what they have
entered is correct, then submit.

regards,
Stephen

Mark Stanton

unread,
Apr 9, 2007, 7:26:12 PM4/9/07
to cfau...@googlegroups.com
Hi Stephen

The web service is pretty damn fast (<500ms for the round trip), but
if you are worried about performance you could validate the format
and/or build up a local cache of ABNs that have passed validation
already.


Cheers

Mark

Andrew Scott

unread,
Apr 9, 2007, 7:30:42 AM4/9/07
to cfau...@googlegroups.com

LOL,

 

Yes Mark...

 



Andrew Scott


Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

 

 

From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf Of Simon Haddon
Sent: Tuesday, 10 April 2007 7:05 AM
To: cfau...@googlegroups.com
Subject: [cfaussie] Re: validating an ABN

 

Oh.  I was not trying to be sarcastic at any time.  I was just trying to help

Andrew Scott

unread,
Apr 9, 2007, 7:34:44 AM4/9/07
to cfau...@googlegroups.com
You know I did not realise that the ABN number had a structure, I thought it
was just a given number that is unique to that business and is either
recycled or incremented.

So this begs the question, what is really so special about the number that
needs validating?

Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

-----Original Message-----
From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf
Of Mark Stanton
Sent: Tuesday, 10 April 2007 9:26 AM
To: cfau...@googlegroups.com
Subject: [cfaussie] Re: validating an ABN

Robin Hilliard

unread,
Apr 9, 2007, 7:46:32 PM4/9/07
to cfau...@googlegroups.com
On 09/04/2007, at 6:58 PM, Simon Haddon wrote:
Hi,

I did this in an excel spreadsheet years ago.  Initially followed the instructions on the ATO website but found they were slightly wrong.

So after a little mucking around and validations against known ABN's I came up with a formula that works. (Which is only slightly different to what the ATO said anyway). 

Hi Simon,

Out of interest is the checksum algorithm currently on the ATO site still incorrect?


Cheers,
Robin

______________

Robin Hilliard
Director - RocketBoots Pty Ltd
Consulting . Recruitment . Software Licensing . Training

For schedule/availability call Pamela Higgins:

or Direct:


Mark Stanton

unread,
Apr 9, 2007, 8:13:11 PM4/9/07
to cfau...@googlegroups.com
> So this begs the question, what is really so special about the number that
> needs validating?

An ABN is one way of establishing identity. It's like to a drivers
licence or social security number for companies (except that the
information associated with it is public). In my mind it is different
to a phone number in this respect. It is one thing to have a number
that matches the pattern of an ABN, it is another to have an verified,
active ABN, because from there you can gather all sorts of other
information like GST status, registered address, trading name, etc...

If you need to do business with other companies this is very important.

Imagine you provide financing for company cars and I'm on your website
filling out some forms to set up a new lease. If I make an honest
mistake and get a couple of digits wrong on my ABN, this is going to
impact the validity of the lease agreement and the correctness of your
accounting.

Add to this that I could deliberately be providing you with an ABN
that looks right, but isn't ok for business (e.g.
http://tinyurl.com/23rxso).

Andrew Scott

unread,
Apr 9, 2007, 9:35:04 AM4/9/07
to cfau...@googlegroups.com
Mark,

Thanks I am very well aware of what the ABN signifies, or did you not read
the question properly.

As far as the wrong ABN number on forms yes I am aware of that, but until
this discussion I wasn't even aware that the ABN has a checksum style
attribute embeded in the number.


Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273

-----Original Message-----
From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf
Of Mark Stanton
Sent: Tuesday, 10 April 2007 10:13 AM
To: cfau...@googlegroups.com
Subject: [cfaussie] Re: validating an ABN

Simon Haddon

unread,
Apr 10, 2007, 12:33:11 AM4/10/07
to cfau...@googlegroups.com
Hi,

Yes it looks like it is correct.
--
Cheers
Simon Haddon

Simon Haddon

unread,
Apr 10, 2007, 12:34:39 AM4/10/07
to cfau...@googlegroups.com
The only troube with building up a local cache is then you hae to keep the cache current. I would create a hybrid solution that did internal checking first.
Reply all
Reply to author
Forward
0 new messages