Loading...

SharePoint GUID fields

SharePoint GUID fields

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #4121
      Anonymous
      Anonymous
      Participant

      Ok, so this is not specifically a Quest Web Parts question, but I wonder if someone here might have some insight.

      How does SharePoint create its GUID values?  Are the completely random?  Are they “seeded” with values like the time the list item was created or the ID of the user creating the item?  Does anyone here know?

      The reason I ask, is that I’m trying to create a site that includes a sort of “lottery” function.  Users sign up for a lottery, are sorted randomly and the top 50 or 100 or whatever number of users “win.”  I need to create a random number field to handle the sorting.  Since my employers don’t want any custom code, I figured maybe I could extract some single charactes from the list item’s GUID, convert them from hex to decimal and then add them together to make an almost-random number.

      What I want to avoid, of course, is basing my almost-random number be based on values the give an advantage to certain user names, certain times of the day or anything similar.

      Thanks.

      Tom

    • #4893
      Anonymous
      Anonymous
      Participant

      Hi Tom,

      I think you could probably try to define a workflow using SharePoint Designer which when instantiated will populate the random number field. If there is no out-of-the-box random function available in SharePoint Designer, if could be difficult to accomplish what you're trying to do without using custom code. Even if you are using GUIDs to build new values, you would have to extract the numbers out of the GUID values which have alphanumeric characters. There is also no guarantee that the extracted numbers are unique IDs so you could end up with duplicate values.

      I think the most straight-foward way is to write some custom code to create a new workflow using Visual Studio. You can then use the Random class from Microsoft to generate a random number and update the number field in a workflow activity.

      Yuan

Viewing 1 reply thread

You must be logged in to reply to this topic.