You are viewing limited content. For full access, please sign in.

Question

Question

Format token date/time

asked on February 24, 2017

Hi, I'm trying to generate a unique ID based on a submitted form.

 

I want it to be in the form:

 

processID-submissionID-submissiondate for example

105-1044-20170224

 

The first two (process and submission ID) are no problem as I simply used the tokens. However, for the submission date, the token for that shows for example "2/24/2017 4:46:56 PM".

So I have

105-1044-2/24/2017 4:46:56 PM

 

Is there a way I can make it so the date shows up as desired? I want it so that the reviewer of the form sees the form's ID when reviewing it. Everything works correctly except for the formatting of the submission date.

 

Thank you

0 0

Answer

SELECTED ANSWER
replied on February 26, 2017 Show version history

In theory, you should be able to do the date formatting with formulas.  The idea is that most basic formulas that would work in Excel should work in Forms.

In Excel, you could achieve this like this:
=TEXT(TODAY(), "yyyymmdd")

However, in Forms, it's telling me that there are two many criteria being submitted in the formula, so I don't know what's up with that - I wonder if it's a bug...

This more complex formula can do it, and I've confirmed that does work in both Excel and Forms (ver 10.2):
=YEAR(TODAY()) & RIGHT(CONCATENATE("0",MONTH(TODAY())),2) & RIGHT(CONCATENATE("0",DAY(TODAY())),2)

The RIGHT() and CONCATENATE() formulas are just to ensure that single-digit month and day values have leading zeros.

2 0
replied on February 27, 2017

Although your formula does indeed work for today's date, I was trying to use it on a variable instead and I couldn't get it to work. It's a moot point at the moment since I can't spend any more time on the issue right now and simply scratched the date part, but I'd love to understand how to make it work from a personal standpoint.

 

I can create a date variable in Forms in the YYYY-MM-DD format but when I attempted to use the created date variable in a text field it just didn't show up at all.

0 0
replied on February 27, 2017

You should be able to just replace the three spots where is says TODAY() with the name of your date variable.  If the date is already stored in a date field, you shouldn't need to do anything regarding the format because it'll actually use the date numerical behind the scenes.

=YEAR(my_date_field) & RIGHT(CONCATENATE("0",MONTH(my_date_field)),2) & RIGHT(CONCATENATE("0",DAY(my_date_field)),2)

0 0
replied on February 27, 2017

"Should" is the key word there. I tried it and it didn't work for me, which was strange because you would think it should function identically to using TODAY().

 

I even tried simplifying it to =YEAR() with the name of my date variable in the parentheses but even that didn't work.

0 0
replied on February 27, 2017

Weird...  because it works great for me...

I'm on version 10.2 - are you as well?

And are you hand-typing the variable name or using the variable picker?

That's the only explanations I can think of regarding why we'd be getting different functionality.

If it continues to not work for you, we might be at the point of needing someone from Laserfiche to step in...

1 0
replied on February 27, 2017

I can't really test it anymore since the form I was working on was already shown to a potential customer without the date involved and have had to move on to other work, but I'll still mark your answer as correct since it's very helpful and I'm sure if I tinkered a little bit more I'd get it to work.

 

Thanks!

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.