Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


fritfald
2022-08-10T10:28:54Z
Hi
Is there a VC function to generate random numbers?
Sponsor
Forum information
thomas
2022-08-11T08:34:27Z
Don't think so. You can make one fairly easily using c#, powershell or even an sql function. Put it it in a separate job/task and call it from wherever you need to.

fritfald
2022-08-11T08:38:54Z
I solved it by adding milliseconds to the time-date that I put on the filename, then the filename got unique.
bweston
2022-08-16T20:55:37Z
For future reference, in situations like this where what you really need is a unique string, and the subset of those situations where length isn't an issue, and milliseconds isn't appropriate for whatever reason, there is a String.GUID under Functions.

There may also be circumstances in which the job or task unique execution IDs would be helpful for similar purposes.
fritfald
2022-08-17T06:34:03Z
thats exactly what I'm looking for.

Regarding length it could be adjusted by:

{STRING(Right|{STRING(GUID)}|6)}

or any number but 6, depending on length.
thomas
2022-08-17T07:20:14Z
There is a file function that could be used also. Hadn't seen this one before:

image.png
bweston
2022-08-17T13:35:38Z
Originally Posted by: fritfald 

thats exactly what I'm looking for.

Regarding length it could be adjusted by:

{STRING(Right|{STRING(GUID)}|6)}

or any number but 6, depending on length.



Just keep in mind that truncating a GUID means a corresponding increase in likelihood of collision.
Joey S
2022-08-18T18:57:14Z
What thomas wrote is the best method if you want just numbers

Powershell script
Get-Random -Minimum -000001 -Maximum 999999

image.png

image.png

Michael Fjellström
2022-11-11T14:44:38Z
Originally Posted by: Joey S 

What thomas wrote is the best method if you want just numbers

Powershell script
Get-Random -Minimum -000001 -Maximum 999999

image.png

image.png



Thanks, Joey and Thomas for your help and contribution on this issue.
Scroll to Top