GUID

Home Forum General GUID

Tagged: 

This topic contains 13 replies, has 0 voices, and was last updated by  Anonymous 6 years, 11 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #872

    Anonymous

    Is there a way to create a GUID with PF.

    A globally unique identifier is a unique reference number used as an identifier in computer software. The term GUID also is used for Microsoft’s implementation of the Universally unique identifier (UUID) standard. It is commonly known as a “GOOEY ID” in Call of Duty 4 game servers.

    The value of a GUID is represented as a 32-character hexadecimal string, such as {21EC2020-3AEA-1069-A2DD-08002B30309D}, and is usually stored as a 128-bit integer. The total number of unique keys is 2128 or 3.4×1038. This number is so large that the probability of the same number being generated randomly twice is negligible.

    #5938

    pmeidinger
    Participant

    I don’t know if PF can do this, but I would create a view in an SQL Server database that just does a

    Code:
    select NEWID()as NewGUID

    , and make a database connection action for that view. Not sure if there’s an equivalent in the other database server types, though.

    #5939

    pmeidinger
    Participant

    Me fail markup. That would be:

    select NEWID()as NewGUID

    #5940

    Anonymous

    thanks for the reply. I was trying to generate the guid before I inserted it into sql. To get things going I made a poor mans guid using the form id number in a string.

    #5941

    You can do this using the Random function, a few helper fields, and a table (like Macgyver).

    Create a table with 36 rows, one for each letter of the alphabet and 0 through 9.

    Generate a random number between 0 and 36 and go to that row # of the table. To do this build a looping behavior that starts at the first row, then goes to next row, etc, and counts each loop until you have reached your random number.Take the value in that row of the table and add it to your result field.

    Run this behavior enough times through until your GUID is the proper length.

    You will also have to build behaviors that add your “-” characters at appropriate intervals.

    #5942

    Anonymous

    Wow. Dennis you need to get out more. Thanks for the reply.

    Just for fun I will build it and test your application. I understand most of your instructions except for the “random function”.

    What’s that?

    #5943

    I get out plenty, that is what keeps the brain malleable… Please refer to our help guide regarding this list of functions in the formula editor: http://www.perfectforms.com/Documentation/manual/html/?fg_functions_in_the_formula_editor.htm

    Workflow software, Process software, Procedure software

    #5944

    pmeidinger
    Participant

    Wow, that seems like a lot more work than:

    1. Create a view in SQL as select NEWID()as NewGUID

    2. Create SELECT action in a Database Connection that queries that view

    3. Use a Connect object in the form for that action, returning the NewGUID to a helper Text Input Field

    4. Insert your other data into your database, using the GUID in the helper Text Input Field

    #5945

    I built a sample form that creates a random 32-character hexadecimal string. To try it click here: Random 32-character hexadecimal string.

    If you would like a copy of the .pf file so you can have the form yourself, let me know and I will email it to you.

    Workflow software, Process software, Procedure software

    #5946

    Anonymous

    Thanks. I like both ideas. I think the best for this application is the GUID without a connection. Dennis can you send me a copy of the .pf file?

    I never noticed the random function before. I guess I never had a need for it till now.

    #5948

    Anonymous

    It’s worth noting here that GUIDs (or UUIDs for that matter) are hex only. The form you create above and the suggestion made before use all letters of the alphabet between A and Z and 0-9 while hex is only 0-9 and A-F. This one of a few reasons I would recommend using your database’s default GUID() function.

    #5950

    Thank you for pointing that out. I did not know the distinction. I have amended the form to reflect 0-9 and A-F, it can be viewed here: Random 32-character hexadecimal string

    Workflow software, Process software, Procedure software

    #6029

    Anonymous

    It’s random but is it universally unique?

    #6031

    I will assume that by universally unique you mean that it is not repeated in this closed system. In its present state it is not, but that would not be hard to accomplish.

    After creating the GUID submit the form so it creates an instance. Create a connection to the form. In the form as part of the behavior send the resulting GUID as a send parameter. If there is a match then wipe it clean and start over.

    Workflow software, Process software, Procedure software

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.