Generating IDs with Text 
Author Message
 Generating IDs with Text

Here is a rather simple problem that I am looking to optimize.

I need to generate uniqueIDs. The ids must be in the form of 'Title' +
(optional numeric index)

So a sequence of titles might go something like this (the user provides the
'Title' - and I have to make it unique against previously issued IDs)

MyTitle
SomeOtherTitle
AnotherTitle
MyTitle1
MyTitle2
AnotherTitle1
SomeOtherTitle1
MyTitle3
SomeOtherTitle2

and so on. I can have a list of existing ids in pretty much any format.
Everything I have done so far is cumbersome, mostly because I do not know
much about VBScript.

Can anyone think of an optimized way of doing thi, that is also considered
clean and safe VBScript code?

thanks,
BB



Sat, 23 Jul 2005 00:36:11 GMT  
 Generating IDs with Text
Hi,

Assuming that you don't have a security issue with the
FileSystemObject, VBS will generate random
8-alphanumeric-character names for temporary files.
It sounds like this may be sufficient for your purposes.
You can always get multiples and concatenate them to
16-, 24-, 32- character ids.  A more random solution
involes the generation of GUIDs. but that's not "simple
VBS."

Set oFileSys= CreateObject("Scripting.FileSystemObject")
sTitleID= oFileSys.GetBaseName(oFileSys.GetTempName)

Joe Earnest


Quote:
> Here is a rather simple problem that I am looking to optimize.

> I need to generate uniqueIDs. The ids must be in the form of 'Title' +
> (optional numeric index)

> So a sequence of titles might go something like this (the user provides
the
> 'Title' - and I have to make it unique against previously issued IDs)

> MyTitle
> SomeOtherTitle
> AnotherTitle
> MyTitle1
> MyTitle2
> AnotherTitle1
> SomeOtherTitle1
> MyTitle3
> SomeOtherTitle2

> and so on. I can have a list of existing ids in pretty much any format.
> Everything I have done so far is cumbersome, mostly because I do not know
> much about VBScript.

> Can anyone think of an optimized way of doing thi, that is also considered
> clean and safe VBScript code?

> thanks,
> BB



Sat, 23 Jul 2005 00:56:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Generating unique IDs easily

2. Generate fixed-length, unique IDs?

3. Code to generate unique ID

4. Generating ID

5. Generate ID with specific increments

6. How to generate a machine unique ID

7. Routine for generating a program id

8. System Generated Unique ID's

9. Generate next ID in Access95

10. System Generated ID's

11. How to generate random id?

12. SQL Server, multiuser, and generating unique ID's

 

 
Powered by phpBB® Forum Software