Reputation: 1650
I need to extract a date out of a invoice number and subtract one month from the month. For example if a invoice number is I2011101002683 I need to pull out the 2011, four numbers starting a position 1, and then the 10, two numbers starting a position 5. and display the date in a 2011/09 format. Thanks in advance.
Upvotes: 0
Views: 631
Reputation: 26272
Create a formula field to extract the date:
//{@invoice_date}
//I|2011|10|1002683 --> Date(2011, 10, 1)
Date(ToNumber({Command.InvoiceNumber}[2 To 5]), ToNumber({Command.InvoiceNumber}[6 to 7]), 1)
Add the resulting formula to the canvas; format it as desired.
Upvotes: 0
Reputation: 169524
One way:
numbervar year_start := 2;
numbervar year_len := 4;
numbervar month_start := year_start + year_len;
numbervar month_len:= 2;
mid({Command.InvoiceNumber},year_start,year_len) + "/" +
mid({Command.InvoiceNumber},month_start,month_len);
Upvotes: 1