How can I use RelationshipFilter in 2sxc Visual Query with text field instead of entity field?

49 views Asked by At

I'm trying to do the same as this example does under title "Attribute-On-Relationship to Query other Fields". I'm editing Blog application visual query. So I have RelationshipFilter, which takes entities of type Category via Default in point. And I want to filter them by field Name. Here I can get list of names either from params or from list of posts and their categories. That's not a problem as far as I understand.

So looks like Name has to be of entity type. I'm struggling right now with this filter, since I want to filter Category by field Name of simple text type. Which means that I have nothing to specify in Relationship Attribute. EntityTitle or just empty Relationship Attribute field don't work and cause Bad Request error. So is there a way to make it work?

P.S. ValueFilter is not an option, since it doesn't support returning nothing if there are no items, that satisfy condition and also it supports only filter by item's Attribute, that contains Value and no option that Value can contain any in Attribute with separator.

1

There are 1 answers

7
iJungleBoy On

The RelationshipFilter is only meant for relationships (item with item) - and you seem to want to do a string-compare.

I'm not really sure what you should do because I don't have context, but if things get really special, best use LINQ instead. Check out the tutorials for LINQ here: https://2sxc.org/dnn-tutorials/en/razor/linq/home