yuuvis® Q&A

0 votes
in yuuvis Momentum by (350 points)

Hi,

I defined property that has the classification id:reference[myObjectType] in it.

Is it possible to filter the selection list that appears when a user starts typing in this field? Only objects with specific metadata should be shown in the selection list.

Something similar is solved in RAD.

Thank you and regards, Mathias

2 Answers

+1 vote
by (2.3k points)
selected by
 
Best answer

Hi Mathias

You can achieve this behavoir by using triggers: https://help.optimal-systems.com/yuuvis_develop/display/YMY/Extending+Clients+with+Plug-ins#ExtendingClientswithPlugins-Plug-inTriggers%E2%93%98

For example the following trigger will read the field "tenTest:id" on the current form and always add a filter for the field "tenTest:id" with the value from the form, to the lookup of your referenced type:

"triggers": [
          {
            "id": "yuv.custom.trigger.reference",
            "matchHook": "yuv-reference",
            "isExecutable": "() => parent.formControlName === 'tenTest:referencefield'",
            "run": "() => { var ref = parent.childComponent; ref.searchFnc = (term) => { var ids = [api.form.getValue('tenTest:id')]; ref.filters = ids && ids[0] ? [{'f':'tenTest:id','o':'in','v1': ids}] : []; return Object.assign({term : '*{0}*'.replace('{0}', term)}, ref.queryJson);}; }"
          }
        ]
Kind regards
Nicole
0 votes
by (2.0k points)

Hi Mathias,

If you specify concrete object type IDs in this classification attribute, you limit the selection list offered to your users to those object types. E.g., your example value 'id:reference[myObjectTypeID]' would lead to a selection list containing only the item 'myObjectTypeID' or the corresponding object type name if available.
>> Documentation of Property Classifications

Best regards,
Antje

by (350 points)
Hi Antje
Thank you for your answer.
Is it also possible to filter the list by specific metadata?
Example: The object type myObjectType has a property called active (booelan). In the selection list, only elements should be shown when active is true.
Limiting the objects rights is not possible because the users need to see all object types in other use cases.
Regards, Mathias
by (2.0k points)
Hi Mathias,

So far, it is not possible to specify conditions for 'id:reference[]' classification. You can only explicitly specify object types that should be available in the selection list and thereby indirectly exclude all other object types. We are thinking about a more elegant solution.

However, I do not really understand what is the behavior you would like to implement for your selection list. If you want a selection list of object types, the schema is evaluated that does not contain metadata of individual objects. The schema can only tell you which property is referenced in which object type and only knows about its general attributes. A search for concrete objects with specific metadata is a different topic.

Best regards,
Antje
...