Q

Generate a Windows Globally Unique Identifier

We have an application that uses a database for each state -- this is for the convenience of the users. However, for reporting purposes, we move everything into a single database. This creates a huge drain on server resources as we remove and add documents -- the process is laborious simply because we want to ensure we don't end up with duplicate UNIDs, no matter how remote the chance.

We're looking into other ways to generate unique keys, and we'd like to know if there's a way via LotusScript to

generate a Windows Globally Unique Identifier (GUID). I've done some searching and people only talk about them, not how to generate them on the fly. Can you help?

I once created a script routine that created a time stamp using 32 characters and then verified the existing key didn't exist. If it did, then it added an additional digit. Probably the easiest way to create unique IDs is to use the @Unique function to generate a part of a key, a database identifier as prefix and then append an 'a' or '0.' Verify the key doesn't exist in the current database, if it does already exist, then increment the last digit and verify again.

So, IF I created a document, @Unique would generate a key like BMAY-66RH28, where the first segment was generated from my userID and the last part is related to date and time. IF the keys are all generated by an agent and signed by the same ID, the first part is not really relative. Start with a database, or a state identifier, PA, add the timestamp part of @Unique, 66RH28 and an initial differentiator -- 0 to get a possible key of PA-66RH28-0. Check if a document exists with that key, if it does increment the differentiator by one and check again.

In some applications, we change the position of the differentiator and database identifier so that the 0 doesn't always appear at the end of the key. So possible variations of the same unique identifier, PA-66RH28-0, in different formats could be PA66RH280, PA-066RH28, 66RH280PA and 0PA66RH280.

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in November 2004

Dig deeper on Lotus Notes Domino Application Development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close