Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Making a script combining two fields to make a casenumber

rick_vb
Level 1
Level 1

Hello,

My name is Rick and I really need your help.

While building a form that helps end-users report complaints, I'd like my form to automatically make a casenumber by combining two fields.

I've tried figuring scripts out on my own, with the 'help' function, searching forums but no salvation yet.

I look forward to your reaction!

1 Accepted Solution
Niall_O_Donovan
Correct answer by
Level 10
Level 10

Hi,

Just for starters, it looks like you have the script in a numericField. Change the type to a textField.

Niall

View solution in original post

5 Replies
Niall_O_Donovan
Level 10
Level 10

Hi Rick,

LC Designer has two languages: Javascript and FormCalc.

You can use either one for your requirement. FormCalc is handiest as it includes a concatenation function that can join multiple fields into a separate field.

If the two fields are 'fullName' and 'location' the script in the calculate event of the caseNumber field could be:

$ = Concat(fullName, "/", location)

In Javascript it would look like this (also in the calculate event):

this.rawValue = fullName.rawValue + "/" + location.rawValue; 

Either of these should achieve what you want.

Good luck,

Niall

rick_vb
Level 1
Level 1

Thanks a lot for your help! Still, it isn't working properly. The form doesn't execute the script when I send it, leaving te field saying "0". This is my script: this.rawValue = Datum.rawValue + "/" +  Organisatie.rawValue

What would even be better is a calculation which makes a casenumber based on the date plus a number or text like: 08022010001 or 08022010a.
Niall_O_Donovan
Correct answer by
Level 10
Level 10

Hi,

Just for starters, it looks like you have the script in a numericField. Change the type to a textField.

Niall

View solution in original post

rick_vb
Level 1
Level 1

Thanks! That's it!

Can i also add something to the script to provide a random number?

Niall_O_Donovan
Level 10
Level 10

Hi,

Here is a sample where the reference number is the full date and time, down to the second. https://acrobat.com/#d=7MTJmmhWCVSfQQir3XwxXQ

Here is a sample of a random number generator. It creates a 4-digit random number of a click event, but you can extend this. https://acrobat.com/#d=iVdJ1rAWKPL7qXj8zLs9yg

Good luck,

Niall