[QGIS-Developer] Factorizing a dbf

Nyall Dawson nyall.dawson at gmail.com
Tue Jan 23 22:37:34 PST 2018


On 24 January 2018 at 16:25, Paolo Cavallini <cavallini at faunalia.it> wrote:
> Hi Nyall,
>
> Il 23/01/2018 01:16, Nyall Dawson ha scritto:
>
>> Option 1:
>> Run the "Add unique value field index" algorithm to add an
>> autogenerated code for each unique category. Then, run the "List
>> unique values" algorithm selecting both the original field and the
>> newly created field for the "target fields" in order to get a summary
>> table mapping the new categories to their original values (or wait
>> until https://github.com/qgis/QGIS/pull/6132 is merged, which adds
>> creation of this summary table as an option to the alg... then you can
>> do this with a single algorithm execution)
>
> great, thanks for the improvement! this solves things brilliantly.
> what would be great is the possibility of doing the same thing for more
> than a column in the same execution. it is cumbersome to do it over and
> over for a large table.

How would you see this working within processing? I guess you could
select all the desired columns, and then an auto-generated field name
could be made for each new field based on the original column. It's
probably best left to a separate algorithm though.

> one further improvement would be to automatically add in the layer
> property style the summary table as Value map.

Good idea. This relates to a request on this list a week or so ago,
where someone wanted an algorithm to be able to specifically set the
style of generated layers. There's currently no support for this in
processing algorithms, but there's no reason (well... apart from
time/cost) we can't add it in for >= 3.2.

> should I open feature reqs for this?

Yes

Nyall


More information about the QGIS-Developer mailing list