I was wondering how is it possible to limit the visibility of the enumeration values in an enumeration E according to one condition specified in an input form (for example current operator group, or one named right the operator owns)
Example: ENUM E: A,B,C,D
OPERATOR GROUP "OpA" --> Field myValue using ENUM E : dropdown list will show values A,B,C
OPERATOR GROUP "OpB" --> Field myValue using ENUM E : dropdown list will show values B,D
Could you tell me how is it possible to do that inside an input form ?
- Creation of a relation table between the Operators and the Enumeration Values tables (N-N), this table will contains the operatorId and the enumValueId (same principle than between the recipients and the recipients lists).
- Linking the Operators and the Enumeration Values tables with the new relation table.
- Adding a "sysFilter" in the input defined in the input form:
You can do this with schema sysfilters and joins. Sysfilter you're conditionally appending predicates to the where clause, usually current operator has a right or is admin. I'm not sure how dbEnums behave with schema sysfilters tacked on (to xtk:enum), but sounds like something that should work.
The principle works with the enumeration values but I unfortunately did not found a way to apply this to the enumerations from schemas.
It is possible to create two enumerations in the schema and call the good one in the form depending on the operator but this solution means that we have two different fields in the database and I think it's not really clean.