IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Generate a random number Options · View
skilaru
Posted: Monday, November 9, 2009 8:19:54 PM
Rank: Newbie

Joined: 11/3/2009
Posts: 1
Is it possible to generate a random number in mapforce? I'm generating XSLT 2.0 output and need a unique id/number to be created.

Thanks.
rauger
Posted: Monday, November 16, 2009 1:33:52 PM
Rank: Newbie

Joined: 1/11/2007
Posts: 6
Location: Germany
Hello,

if it just had to be unique, look at "create-guid" from the generator functions.

Regards,

rauger
rip
Posted: Monday, November 16, 2009 1:45:09 PM
Rank: Advanced Member

Joined: 7/17/2008
Posts: 185
Location: Minutiae, Triviality
the requirement was "xslt2" which doesn't supply a random number concept so no create-guid.

You can use a rather slow algorithm based on date-time functions, string manipulation, etc, but you can't guarantee that you will get a unique value probably.

generate-id will return a unique value based on the instance file, which may be sufficient, but if you need something approaching "globally unique" that isn't something xslt is prepared to offer you.

Extension functions might work, if you want to write your random id generator in java or c# or something.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.