Pogues icon indicating copy to clipboard operation
Pogues copied to clipboard

Dynamic Unit on InputNumber

Open laurentC35 opened this issue 1 year ago • 4 comments

ToDo

image

Eno : https://github.com/InseeFr/Eno/issues/715 Lunatic: https://github.com/InseeFr/Lunatic/issues/668

laurentC35 avatar Sep 13 '23 14:09 laurentC35

As mentioned in previous issues, i would prefer to have in this case an exclusive path, like a switch button for choosing between static and dynamic measure units?

But most importantly, if we allow for dynamic, what is the use for a static unit list? Most designers would just use the dynamic option and write whatever they like as units. 🤔

So probably having dynamic measure units means deleting static ones, maybe at the expense of harmonization.

romaintailhurat avatar Sep 20 '23 13:09 romaintailhurat

⚠️ impacts on Pogues-model & ddi

Currently in jsonPogues, unit is actually an url, used in transformation to ddi for getting the value of the unit.

{
        "id": "lypl2fz1",
        "Name": "QUESTIONNO",
        "type": "CollectedVariableType",
        "Label": "QUESTIONNO label",
        "Datatype": {
          "Unit": "url_of_unit",
          "type": "NumericDatatypeType",
          "Maximum": "10",
          "Minimum": "1",
          "Decimals": "",
          "typeName": "NUMERIC"
        }
      }

If we want to make the difference between VTL expression or url (that leads to a different transformation), we need to change Pogues-Model

Then, in ddi, we do have

<l:VariableRepresentation>
               <r:NumericRepresentation>
                  <r:MeasurementUnit>€</r:MeasurementUnit>
                  <r:NumberRange>
                     <r:Low isInclusive="true">1</r:Low>
                     <r:High isInclusive="true">10</r:High>
                  </r:NumberRange>
                  <r:NumericTypeCode controlledVocabularyID="INSEE-CIS-NTC-CV">Decimal</r:NumericTypeCode>
               </r:NumericRepresentation>
            </l:VariableRepresentation>

We cannot directly give the expression in <r:MeasurementUnit>

QRuhier avatar Jul 17 '24 14:07 QRuhier

Modélisation:

<r:MeasurementUnit>¤VAR_COLLECTED¤</r:MeasurementUnit>

ou

<r:MeasurementUnit>€</r:MeasurementUnit>

laurentC35 avatar Aug 23 '24 07:08 laurentC35

Because of DDI modelisation, for dynamic unit we must save as value the id of a variable. Instead of displaying a 'VTL field' , we propose to display a dropdown containing all the variables (collected, external, calculated), then the user must chose a reference variable that may contain a VTL expression

QRuhier avatar Sep 10 '24 15:09 QRuhier