I have a form that (currently) has 100 records in it. I’d like to assign an identifier number to each. Something like a 7-digit random number would be ideal. Is there a way that Tap Forms can do that for me?
Hi Greg,
You could use a Calculation field and use the function RND() to generate a random number which you could use.
Enable the new “Calculate one time only” setting on the Formula Edit screen in Tap Forms 5.2.1 and that’ll cause the random number to be generated only one time for each record.
When you add a new record you’ll get a new random number.
Here’s an example that’ll return a random number between 0 and 10,000:
FORMAT(RND() * 10000, “00000”)
It will also format it so it has leading 0’s if the number is less than 5 digits wide.
Set the Result Type to Text also.
Hope that’s what you’re looking for.
Brendan
That works great! Thank you.
(One bug I noticed: if you dupe a calculation field, the “Calculate one time only” value will always be false in the dupe, even if in the original record it was true.)
One follow-up question: is there a way to “force” a re-calculation in one particular record if desired?
Hi Greg,
I fixed that bug for the next update.
As for recalculating just one record, yes, there’s a recalculate button at the bottom of the record on the Default Layout. However, it will still respect the “Calculate one time only” setting.
If you want to recalculate, what you could do is edit the formula, un-check that checkbox, then click the Cancel button so you don’t trigger a recalculation of all records.
Then click the refresh button at the bottom of the Default Layout.
Then go edit the formula again and turn it back on, but also then click Cancel.
The reason this works is because the Calculate one time only checkbox button is bound directly to the field’s dontRecalculate
property. The Cancel button will prevent the records from being recalculated.