Number formatting for autogenerated numbers
Asked by Stephen Pease:

Hello Atlassian Community,

I am utilizing a nice guide found here: [Using generate next number IFTTT rule to have sequence numbers per day - Vertuna WIKI - ConfiForms](https://wiki.vertuna.com/display/CONFIFORMS/Using+generate+next+number+IFTTT+rule+to+have+sequence+numbers+per+day) for generating an autonumber that resets each day, however, is there a way to format it so it is always 2 digits?

Right now it outputs 1,2,3,4

But I would like it to output 01,02,03,04.

Is this possible leveraging what is basically a copy-paste of the provided example? Thank you!


Answers:
author: Alex Medved _ConfiForms_
body: You can use formatNumber function by setting the ConfiForms Field macro's field name parameter to seqNo.formatNumber(00) when rendering the value of a seqNo field

![Screenshot 2022-10-18 at 08.51.46.png](https://community.atlassian.com/t5/image/serverpage/image-id/221256i2D4D07EC754809AE/image-size/large?v=v2&px=999 "Screenshot 2022-10-18 at 08.51.46.png")

comments: author: Stephen Pease
body: Hi Alex,

I feel like this is the right way, but I am having trouble getting it to work. Here is the layout of my current setup (only difference is "531" is added to the SeqNo) along with the views of the 3 macros in order.

![Overview.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/221562i4781ECA0603CCE1F/image-size/large?v=v2&px=999 "Overview.PNG")

![ConfiformsFormFieldDefinition.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/221563iAB2B4C54062E00EF/image-size/large?v=v2&px=999 "ConfiformsFormFieldDefinition.PNG")

![IFTTT.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/221564iAD61B0763C8FE6F0/image-size/large?v=v2&px=999 "IFTTT.PNG")

![ConfiformsFormField.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/221565iC916BF578D1BDB0C/image-size/large?v=v2&px=999 "ConfiformsFormField.PNG")

The first standout is that I don't have a macro that only gives me "Confiforms Field Macro"   

Currently, when I get the email, it is still showing single digit numbers with no leading "0" for those single digits (though the email has "\[entry.SeqNo531\]" with nothing added.

I am wondering if I should be putting this in the highlighted section for "Override output format" or if I am just setting it up incorrectly. Thank you!


author: Alex Medved _ConfiForms_
body: Not sure why you use \[entry.field_name\] notations and not ConfiForms Field macros, but... the functions can of course be used there as well

so just put \[entry.SeqNo531.formatNumber(00)\]


author: Stephen Pease
body: I added that line in the email output and now when the email comes in, the sequence number is blank.

Here is a look at the body of the email with the circled part being the main piece of interest. Basically, it does a Julien Calendar number, adds a selection, then creates a tracking number that resets each day. So far it works minus the double digit part, however, if I try to use the format line, the email blanks out the SeqNo531 part. Sorry if I am doing something dumb, just trying to figure out why it is so close but not cooperating.

![email.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/221567i8E8510D45EE0E1FF/image-size/large?v=v2&px=999 "email.PNG")


author: Alex Medved _ConfiForms_
body: I can only think of the garbage added by the editor - are you sure the expression is clean \[entry.SeqNo531.formatNumber(00)\]

Could you verify the storage format for this piece of contents?


author: Stephen Pease
body: I apologize Alex, I'm not sure how to verify this. Is there a specific place for me to look?


author: Alex Medved _ConfiForms_
body: Do you have this [option](https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+FAQ#ConfiFormsFAQ-Whatisstorageformat?)?

Or try to open a notepad and type the \[entry.SeqNo531.formatNumber(00)\] and then copy it from there into the IFTTT in-place of the existing expression and see if it helps


author: Stephen Pease
body: You were correct (as usual). I re-pasted the line into that space and now it is showing up correctly. It was definitely some garbage interference from the editor. Thank you so much, everything is working like a charm. To your bosses - give this man a raise!


author: Alex Medved _ConfiForms_
body: Awesome! Glad to help


Tags: confiforms

confluence-server

server