[Qgis-user] Organizing considering Dates

Tyler Veinot tylerkveinot at gmail.com
Wed Sep 14 06:55:55 PDT 2016


Bia;
In 2.16.2 you can right click the column header and choose sort, this will
bring up an expression builder. In there just add the field you want to
sort by "Field_Name" or you can get fancy and say you want to sort by a
number and a string field. Then you would do something like
this "String_Field"||right(  ('00000000' || "Numeric_Field"), 8) Notice the
"00000000" being added, that is because the expression treats the number
like a string. Padding it with zeros sorts allows it to sort in order
1,2,3,4 if you do not pad you will end up with. 1,10,11,12,etc...
Dual sorting with date is a bit tricky but you can store the data as a
YYYY,MM,DD type and it should sort for you. If your date is stored in
another way, i.e. DD/MM/YYYY then you will have to format it to YYYY,MM,DD
for proper sorting, i.e. Year("Date")||Month("Date")||Day("Date") should
work to that effect.
As for sorting one column Ascending and another Descending I am at a loss,
have not been able to figure that one out but someone here might add to my
answer if you need to do that.
Additionally if your using an older version of QGIS that does not have the
"sort" function you could write the expression to a virtual field and then
sort it by clicking the column header of the new virtual field.
Hope that helps.
Tyler

On Wed, Sep 14, 2016 at 7:38 AM, Bia <bia.fs2000 at gmail.com> wrote:

> Hi, how can I to organize my table considering the date? I tried a
> expression but did not work.
> And after I wanna compare other columns to have a precision table.
>
> Thank you!
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160914/9be398a5/attachment.html>


More information about the Qgis-user mailing list