Generate random numbers in InfoPath
Learn which options are available if you want to generate random numbers in an InfoPath form either with or without writing code.
InfoPath does not have a function you can use to generate random numbers.
So if you want to generate random numbers in InfoPath, you must either write code or find another way to generate random numbers without having to write code.
If you cannot or do not want to write code, you can make use of Excel and Excel Services in SharePoint to generate random numbers in InfoPath.
In such a solution, you would first have to create an Excel workbook and publish it to SharePoint. Then once you have done this, you can set up web service calls from within InfoPath to call Excel Services web service operations to retrieve a random number from the Excel workbook that is stored in SharePoint.
The following InfoPath 2010 video demonstrates how such a solution would work.
A second way to generate random numbers without having to write code is to make use of a basic formula that can generate a random number. The video shown below demonstrates how this formula would work.
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.