Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
7 subscribers
Views
3484 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I wish to generate a random 5=digit ID whenever a process is initiated. For exa
mikec
over 11 years ago
I wish to generate a random 5=digit ID whenever a process is initiated. For example; when a user launches a process I want to have on the form (read-only) a 5-digit ID field where it is populated with this random number and then stored in a PV like submissionID. ...
OriginalPostID-63546
OriginalPostID-63546
Discussion posts and replies are publicly visible
0
Mike Cichy
Appian Employee
over 11 years ago
Is the number supposed to unique? If not, you can use rand() to generate a random number.
forum.appian.com/.../Mathematical_Functions
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
akhilan
over 11 years ago
If you want it random within the process then the rand() function that Mike suggests will work well. Are you looking for a random number across all process instances? You could also leverage, the pp!id of the process instance as it is different for each process instance in Appian. If you are looking for a unique id to identify each submission from the other, you could explore the option of using a database table to store the submission data. Have a primary key associated with each record in the table, which becomes the id you are looking for. Let us say you are using a CDT to save the data into the database table, then you can annotate the primary key field with @Id and @GeneratedValue in the XSD of the CDT. @Id is used to make the field unique and @GeneratedValue is used to make it an autogenerated number. Everytime you insert a record into the table using the Write to Datastore smart service, a new ID will be generated for that record.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mikec
over 11 years ago
If you are looking for a unique id to identify each submission from the other, you could explore the option of using a database table to store the submission data. This is what I am looking for. However, can I expose this unique ID in a form as a process variable? This way users can reference the ID if needed
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
akhilan
over 11 years ago
Yes, you can do that. The record written into DB can be got from the outputs tab of the Write to Datastore node. In the ouputs tab, you can save the record into a PV of type CDT. If you look at the id element of the CDT, the value will be there.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel