Add user defined values to enum field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1605

    Add user defined values to enum field

    Is it possible - like in multi-enum field - to add user defined fields to a single enum field?
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Hello shalmaxb ,

    It is possible with a little work around, what you can do is to use a multiEnum field instead of an enum field and set the "maxCount" parameter in your entityDefs script to 1.

    The user will be able to choose from the pre-defined options or add a new one but only one final choice can be saved. If the user tries to save more than one option an error is triggered.

    Just keep in mind that Enum fields store the value selected as a plain vanilla varchar field and Multi Enum fields store their values as an array like this ["value1","value2","valueX"] in a medium text field.

    So in your case the value will be stored as ["valueX"] not as "valueX" as it would be in the case of an enum field.
    Last edited by telecastg; 10-24-2021, 02:22 AM.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1605

      #3
      telecastg , thank you for your answer. I understand, but this solution will not work for my purpose. I could work with an enum field, only that in this moment I do not know, if there could be necessary further values. So I will have to put possible further values later in the enum field.
      Meanwhile I saw, that is also not possible to hand values from multi enum to another field (what I use for translation of a field value) by formula.
      Example: I have a field that describes a watch type like "wrist watch". I need this field in a German translation. So I created one field for watch type and another one Art der Uhr (=watch type in German).
      By formula I did: artDerUhr=(string\replace(watchType, 'wrist watch', 'Armbanduhr');
      This shold put the value Armbanduhr into the german field, when wrist watch is written into the english field, but this does not work with multi enum, what I guess is because of the array type.

      I will stay then with enum and extend the given values, when they appear.

      Comment

      Working...