Hi @gio, why not use FME functions?
[Updated]
#@Format(%06X,@Evaluate(@int(@rand()*0xFFFFFF)))
Hi @gio, why not use FME functions?
[Updated]
#@Format(%06X,@Evaluate(@int(@rand()*0xFFFFFF)))
In order to get the correct result from a Tcl expression, I'd recommend you to use the TclCaller rather than the AttributeCreator (the @Evaluate function).
format "#%06X" [expr int(rand() * 0xFFFFFF)]

Hi @takashi
Those are the same functions afaik, tcl, wrapped probably. Maybe it is not wrapped correctly?
The hash tag needs to stay in the format string.
I am just wondering why the 0-padding does not work. Or if anyone can hint at why.
Like I said, the spot for the zero gets occupied by a space when I use the expression.
TCL caller, or using testers, creators etc. to use tcl expressions should work. But the missing leading "0" is an obvious bug it seems.
Using the wrapped functions (what you call fme functions) and using the TCL caller to execute the tcl expression, do yield the "0".
Also using
[regexp {^#?([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$} )} AM r g b ]!=0?$r:0
Fails on some of the hex pairs, while the expression works 100% using rubular or any other online expression evaluators.
Whilst using a stringsearcher with the same regexp works on all found instances.
To me this indicates a bug.

Hi @takashi
Those are the same functions afaik, tcl, wrapped probably. Maybe it is not wrapped correctly?
The hash tag needs to stay in the format string.
I am just wondering why the 0-padding does not work. Or if anyone can hint at why.
Like I said, the spot for the zero gets occupied by a space when I use the expression.
TCL caller, or using testers, creators etc. to use tcl expressions should work. But the missing leading "0" is an obvious bug it seems.
Using the wrapped functions (what you call fme functions) and using the TCL caller to execute the tcl expression, do yield the "0".
Also using
[regexp {^#?([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$} )} AM r g b ]!=0?$r:0
Fails on some of the hex pairs, while the expression works 100% using rubular or any other online expression evaluators.
Whilst using a stringsearcher with the same regexp works on all found instances.
To me this indicates a bug.

I too think the FME @Format function calls the Tcl "format" command internally. However, I don't think it's guaranteed that the @Evaluate function returns the correct result of a Tcl expression. I therefore think we should use FME functions rather than Tcl expression, except in the TclCaller.
In use of the FME @Format function, the hash character can be put either front of entire expression or front of the format string. Both return the same result in this case.