[Qgis-user] How fill the attribute table with a fixed-lenght codeblock value

Andrea Peri aperi2007 at gmail.com
Thu Nov 26 03:24:50 PST 2015


Hi,

It is what I was searching !
:)

I dont know before the LPad function and it was not available in the help .

This is the code I use.

  lpad( to_string($rownum),3,'0')

Thx for your help.

A.

2015-11-26 12:04 GMT+01:00 Blumentrath, Stefan <Stefan.Blumentrath at nina.no>:
> Did you try the "lpad" function (in String)?
> Cheers
> Stefan
>
> -----Original Message-----
> From: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of Andrea Peri
> Sent: 26. november 2015 12:00
> To: qgis-user <qgis-user at lists.osgeo.org>
> Subject: [Qgis-user] How fill the attribute table with a fixed-lenght codeblock value
>
> Hi,
>
> I need to fill a filed with a code block like this:
>
> "0001"
> "0002"
> "0003"
> ...
> "0010"
> "0011"
>
> I see the caluclator has the "$rownum" variable, but the result will be this:
>
> "1"
> "2"
> "3"
> ...
> "9"
> "10"
>
> And this is not affordable because the lenght is not costant for us need.
>
> I dont know if there is a solution to allow a fixed-length code-block value in the qgis calculator.
>
> Thx
>
> A.
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------



More information about the Qgis-user mailing list