LimeReport Forum
General Category | Основное => Discussion | Обсуждение => Topic started by: Paul Traut on October 23, 2018, 12:11:20 pm
-
Hello,
depending on the number I would like to have something like
1 -> 001
2 -> 002
.
.
10-> 010
11-> 011
.
.
100->100
and so on.
Howe can I set this within the numberFormat function and is there a Wiki where all possibilities are described?
Thanks Paul
-
Hi!
You can use this trick
1. Put into the initscript next helper:
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
2. use it in TextItem like this:
$S{
(1).pad(3)
}
-
Hi,
thanks for your answer.
My solution now is:
$S{
if ( $S{$D{test.COUNT(*)}+1} <10)
"00"+$S{$D{test.COUNT(*)}+1};
else if ( $S{$D{test.COUNT(*)}+1} <100)
"0"+$S{$D{test.COUNT(*)}+1};
else
$S{$D{test.COUNT(*)}+1}
}
and this works fine for me.
I only thought that there is something with the "numberFormat" function.
Paul