opengisch / QgisModelBaker

Create QGIS projects from database schemas or Interlis models
https://opengisch.github.io/QgisModelBaker/
GNU Lesser General Public License v3.0
52 stars 18 forks source link

Order of ORDERED enums not considered in attribute forms #940

Open webrian opened 1 week ago

webrian commented 1 week ago

The order of an ORDERED enumeration is not considered by Model Baker.

A simple INTERLIS model with a ordered enumeration:

INTERLIS 2.3;

MODEL SimpleTable (de)
AT "mailto:agi@bd.so.ch"
VERSION "2024-05-02"  =

  DOMAIN

    LKoord = COORD 2460000.000 .. 2870000.000 [INTERLIS.M], 1045000.000 .. 1310000.000 [INTERLIS.M] ,ROTATION 2 -> 1;

    SimpleArt = (
      ErsteArt,
      ZweiteArt,
      DritteArt,
      VierteArt,
      FuenfteArt,
      SechsteArt
    ) ORDERED;

  TOPIC SimpleTopic =

    CLASS Table =
      Anzahl : 1 .. 1000;
      Bezeichnung : MTEXT*64;
      Geometrie : MANDATORY SimpleTable.LKoord;
      Art : SimpleTable.SimpleArt;
    END Table;

  END SimpleTopic;

END SimpleTable.

This model is implemented in the (PG) database as follows:

image

The column itfcode represents the order as defined in the data model.

Creating the QGIS project with Model Baker the enum values are ordered in an alphabetical way:

Bildschirmfoto vom 2024-06-25 15-23-30_dialog

I think from a user's point of view it would be preferable if the order of the values corresponded to the data model.

See also the discussion in the INTERLIS forum: https://interlis.discourse.group/t/ordered-enumerations/175

signedav commented 6 days ago

Shouldn't the seq giving the order?

Anyway, I think this would require a QGIS change. Maybe this is something to consider https://github.com/qgis/QGIS/issues/48191

Still Model Baker should then set the sorting to the seq (or itf_code)

webrian commented 6 days ago

Currently the seq column does not correspond to the itf_code. Not sure if this is on purpose or an issue with ili2db?

signedav commented 6 days ago

Yes you are right. I have to clarify that.