Number Format Rule - puzzled !

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Number Format Rule - puzzled !

Post by ACDC »

Hi

I am trying to create an invoice number format as follows

I2007-10-10000

I= letter I for invoice
2007 = current year
10= current month
12345 number

So the numbers will run as follows:
I2007-10-10001
I2007-10-10002
I2007-10-10003
I2007-11-10004

Does anyone have a suggestion ?

Thanks in advance
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

ACDC,

Have you tried to break the invoice # down into a 2 attributes & then concatenating them? If not, I would try building 2 parts independently:

1- IYYYY-MM-
2- sequential invoice #

Then concatenate them together & store in another attribute.

Tom
paddo2002
Posts: 83
Joined: Mon Dec 03, 2007 8:49 pm

Post by paddo2002 »

I have the same problem and haven't yet come up with a better solution other than concatenating them as well. Any better ideas anyone?

PM
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Post by ACDC »

Well it seems to be a simple solution

B.T.W., how do I get the number to start at a specific number like 1000 instead of 1
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Post by ACDC »

tford

I am getting an error in the browser when I concatenate the attributes as suggested

Rule:
Invoice.InvoiceNo=Invoice.InvNoYear+Invoice.InvNoMonth+'-'+Invoice.InvNoNo
This passes the entegrity test

but in the browser I get this error:

"Operation error. com.bas.shared.ruleparser.ParseException Operands of addition expression are of incompatible types"

This is strange because I have a similar rule that concatenates dates and text types , except this it does not contain a number type. So this is probably where the problem is.

How do i get round a number in a rule that concatenates with other types - can I convert the number type in the rule somehow ?
greg
Posts: 124
Joined: Sat Apr 23, 2005 12:46 am

Post by greg »

Try defining Invoice.InvoiceNo as a plain text attribute and convert both Invoice.InvNoYear and Invoice.InvNoMonth to strings before combining them together.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

ACDC,
B.T.W., how do I get the number to start at a specific number like 1000 instead of 1
I store this kind of info in the SystemSettings BO. You could simply change it on a form any time you want to change the number. Obviously this could be dangerous if this was accessible to the wrong person. If you really want to lock it down, you can set it once via form, then change that attribute to "Calculated"

Tom
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Post by ACDC »

Greg
greg wrote:Try defining Invoice.InvoiceNo as a plain text attribute and convert both Invoice.InvNoYear and Invoice.InvNoMonth to strings before combining them together.
How would I convert to a string , I cant find much in the help.

Its interesting, if I change the first concatenated attribute to one of a ref type ,in this case LoginName then it works. As soon as I take the LoginName out then the error returns
Post Reply