To download NI software, including the products shown below, visit ni.com/downloads.
This example application can be used to generate a randomized pairing from a list of names for Secret Santa! The programs prevents you from getting yourself, allows you to put exceptions in so relatives and spouses don't get each other, and the list can be sent via GMail, so the creator doesn't have to know everyones match.
Description
The source code uses the GMail API available in the NI Community to accomplish the emailing. The API is not needed to run the executable, but should be downloaded first if you would like to view and use the source code. The VI creates a random list, matching against duplicates and the exception list, and then emails the match to each recipient, the recipients do not need a GMail account. The exception list is an array of pairs that are entered with combo boxes populated by the main list, so you can select the two names that shouldn't be paired. There is also a second mode of the code if you do not have a GMail account or if you don't want to include your email and password. In order to use this portion of the code you must rebuild from the source code because the .exe window can not be resized. In the source code you will be able to expand the Front Panel in order to "Debug" the code and avoid sending emails and using a GMail account.
Requirements
Steps to Implement or Execute Code
Then click OK
Additional Information or References
Front Pane
VI Snippet
Secret Santa Block Diagram
SubVI Find Pairs
SubVI Send the List
If you receive Error -1172 then make sure you have entered a valid GMail Username and Password in Options
Setting up the Application without GMail (no emails will be sent)
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.