how do I create a number generator in Infopath?

M

Matthew

I am developing InfoPath forms and want to create a field that will generate
its own number based off of information put into the form by the user.

Example:
Wo#: XX-OO-MM-071505-1

Where XX equals the first 2 letters on the Customers Name field (i.e.
MicroFax)
Wo#: MI-

OO equals the first 2 letters of the Location field (i.e. Columbia)
Wo#: MI-CO

MM equals the first 2 letters on the Project field (i.e. Dewatering)
Wo#: MI-CO-DE

The next six digits from the Date Submitted field (i.e.071505)
Wo#: MI-CO-DE-071505

And lastly the Revision field would need to change as the form version
history changed.

of course the Wo field would be a locked field to the user.

Many thanks in advance to you smart people!!!!
 
A

Alex [MSFT]

You can achieve this functionality with Default Values. Double-click on the
text box where you want the calculated value to appear; click on the f(x)
button near Default Values on the Text Box Properties screen. This will
bring up the expression builder. Then, use the concat [string concatenation]
and substring [getting a substring of a string] functions to achieve the
functionality you are looking for. Set this text box as read-only.

Good luck,
Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top