Forum Discussion

mandadavenkat's avatar
mandadavenkat
Occasional Contributor
13 years ago

Random Value Generation

Hello,

Is there a way to send a random and unique value in the JMS Proprty which should not be repeated at all.
Probably System Date and Time would be the good choice for this.

Is there a quick method or function which would populate current sys date timestamp in the JMS property?


Best Regards
Venkat

3 Replies

  • mandadavenkat's avatar
    mandadavenkat
    Occasional Contributor
    I'm using ${=(int)(Math.random()*10000)} for time being but would like to sent the date time stamp to make it more easy for troubleshooting purpose.

    Best Regards
    Venkat
  • MartinS's avatar
    MartinS
    Occasional Contributor
    Hello.

    Try to make a property in property list (its located in project overview).

    Example:
    Property name: uniqueId
    Place this as a value parameter: ${= String.format('6%tH%<tM%<tS%<tL', new Date())}.
    The result is "6actualtime".

    Now place this ${#Project#uniqueId} anywhere you want as a value parameter.

    Hope this helps.

    Regards
    Martin
  • mandadavenkat's avatar
    mandadavenkat
    Occasional Contributor
    Thanks much.

    This is what exactly I want to achieve.

    I changed it a bit to include date as well
    ${= String.format('%tD %<tH%<tM%<tS%<tL', new Date())}