Skip to main content
Question

How to modify the UUIDGenerator so that the ID starts with a letter

  • October 25, 2017
  • 6 replies
  • 587 views

Forum|alt.badge.img

I have to create an UUID and wanted to use the UUIDGenerator. My XSD File has defined the UUID as an ID which may not start with a number. The UUIDGenerator put a number at the front though and I see no way of modifying it. Why is this? and how should I best generator an ID otherwise?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

david_r
Celebrity
  • 8394 replies
  • October 25, 2017

Your XSD is wrong ;-) A GUID starting with any hexadecimal digit [0-9a-z] is perfectly valid.

You can't modify the UUIDGenerator, but you can use e.g. an AttributeCreator with the following expression to replace the first character with an 'a':

a@Substring(@Value(_uuid),1,35)

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3704 replies
  • October 25, 2017

In addition to @david_r 's comment:

It's possible if you're Doctor Who (or have access to a TARDIS or other form of time travel). The first part of a UUID is timestamp-based...


david_r
Celebrity
  • 8394 replies
  • October 25, 2017

In addition to @david_r 's comment:

It's possible if you're Doctor Who (or have access to a TARDIS or other form of time travel). The first part of a UUID is timestamp-based...

It depends on the implementation. For example, the Python uuid module supports 4 different ways of generating a GUID, of which only uuid1() is based on a timestamp (well, a clock sequence at least).

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3704 replies
  • October 25, 2017

In addition to @david_r 's comment:

It's possible if you're Doctor Who (or have access to a TARDIS or other form of time travel). The first part of a UUID is timestamp-based...

Actually, I take that back, some UUID variants are indeed timestamp based, but there's others where time is not a factor. I can't seem to find which variant FME uses.

 

However, a UUID can still start with a number and be valid...

 

 


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • October 25, 2017

Your XSD is wrong ;-) A GUID starting with any hexadecimal digit [0-9a-z] is perfectly valid.

You can't modify the UUIDGenerator, but you can use e.g. an AttributeCreator with the following expression to replace the first character with an 'a':

a@Substring(@Value(_uuid),1,35)
Or I guess he could take the first 8 digits off and attached them at the back of the string. The second set of digits look like they begin with a letter. I'll investigate as well, see if I can find what method of generation we use.

 


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • October 25, 2017
It depends on the implementation. For example, the Python uuid module supports 4 different ways of generating a GUID, of which only uuid1() is based on a timestamp (well, a clock sequence at least).
The @UUID help says: " The identifier is created from a combination of the computer's hardware characteristics, the current time, and a sequence number." - not sure which variation uses those three items. Can't find anything else with a quick look through our internal systems.