Jump to content

Variable Radom number inside a QR code

Recommended Posts

Without a field being supplied what would be a good way to generate a variable random number field to put in a QR code and as a text human readable value for use on a template. The value needs to stay the same per record, so that the QR code and Field value stay the same.

Link to comment
Share on other sites

You can do something like in OnRecordStart to generate a random number between 1 and 10:

randomNumber = Int(Math.random() * 10) + 1;

Change the 10 to whatever upper range you want.

Then you can use that randomNumber variable (or whatever you want to call it) in other rules for barcodes, or just return it as text.

You could also do something like this in OnRecordStart to make that JavaScript variable accessible as a text variable, which you can then use in the Text Editor directly without having to make another rule:

FusionPro.Composition.AddVariable("randomNumber", randomNumber);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...