Filtering in a reference scope

Hello everyone,

I have got the following structure:

ConnectionType --------child-----> ProtocolReference ----reference----> Protocol

Where ConnectionType, ProtocolReference and Protocol are concepts. ProtocolReference exists, so I can reference multiple Protocols from a ConnectionType and a Protocol can also be associated with multiple ConnectionTypes.

I also have another concept, called Connection, which has optional references to both Protocol and ConnectionType. I want to specify the scope on both of these references. It should possible for the user to only select a ConnectionType or only select Protocol, but when one of both is selected, the selection option for the other should be filtered according to the relationship between ConnectionType and Protocol. Any ideas how to do this?

I tried SimpleRoleScope, which works fine if there is a direct connection between ConnectionType and Protocol, but I can't get it to work with ProtocolReference in the middle...

-Julian

0
6 comments

I would suggest to use ListScope or FilteringScope to implement this functionality.

Vaclav

 

0
Avatar
Permanently deleted user

Thanks, Vaclav! Do you know how to get a list of all instances of a concept in order to put it to the FilteringScope or the ListScope?

0

Since you have both ConnectionType and Protocol specified for a Connection, I would suggest to base your scope queries on these nodes, e.g.

nlist possibleProtocols = this.connectionType.protocolReferences.protocol

return new ListScope(possibleProtocols) {...};

To get all nodes of a particular concept in a model, use "this.model.nodes(MyConcept);"

0
Avatar
Permanently deleted user

Thanks a lot for the help! I found references to this while defining scopes in some other posts on the forum, however for me, this is undefined. _this exists, but it does not have a model property:

0

In the reference scope function you should use "contextNode"

0
Avatar
Permanently deleted user

Thanks! I just got it working. A Connection can now have multiple Protocols (not just one as originally). This is my solution (it is now a constraint on ProtocolReference), maybe it helps other people:

 

0

Please sign in to leave a comment.