yuuvis® RAD Q&A

+3 votes
by (2.1k points)
retagged by

Hello,

We are trying to implement a drop down menu(s), which allows me to select a entry out of a supergroup.

When searching for the object with this indexfield(s) we need to be able to search it by it's supergroup.

What we have tried so far:

  1. Using a layered catalog.

We created a catalog with this structure:

This would be exactly what we need. Sadly though when searching for "Unterhaltungselektronik", there are no results even though there are objects with the type "Unterhaltungselektonik/Tonaufzeichungsgeräte" in existence, which makes the layered approach not viable.
I have been told by OS today, that this is in fact intended behavior, so this is not an option for us.

  1. Using a filter.

We have tried to filter the catalog above to match our criteria. To do this we have a second catalog that matches all the INNERENTRYs of the catalog above.

When selecting one of the supergroups we want to delete all the entries in the catalog except for the LEAFENTRIES of the respectable supergroup.

This is the code we have used to try to achieve this:

scope.model.produktgruppenkatalog.applyFilter(function(entry) {
	console.log(entry.data + ": " + entry.type);
	return true;
});

var isProduktgruppe = false;

scope.model.produktobergruppenkatalog.onchange = function() {
	scope.model.produktgruppenkatalog.applyFilter(function(entry) {
		console.log(entry.data + ": " + entry.type);
		if(entry.type === 'LEAFENTRY' && isProduktgruppe){
			return true;
		}
		isProduktgruppe = false;
		if(entry.data == scope.model.produktobergruppenkatalog.value)
			isProduktgruppe = true;
		return false;
	});
}

This produces folloing console statements: http://prntscr.com/kjfmq3
The top part is the initally filter that just returns true. In the bottom half it shows, that there is only INNERENTRIES in the catalog.
I'm quite certain that this is because the catalog instantly filters out all the LEAFENTRIES, right after I fitler out the supergroup, which makes this approach also fail.

  1. Microservice

Currently we are using a microservice to solve this problem. This way we can get both cataloges with REST Calls and create a list of the entries we need out of is (depending on the value in "Produktobergruppen"). Then we can fill a dynamic list with the result.

This approach works, but seems way to complicated from a technical POV to me. I'd love to reduce the complexity of our system and get rid of this.

We could technically do the same in JavaScript, but that seems to be too much logic for a form Script for my taste.

Does anyone have an idea, how we solve this problem smoothly?

Thanks :)

3 Answers

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

In neartime we will solve this requriement. Ticket COOL-8283

0 votes
by (2.0k points)

Hi,

what you could try doing is to use the special properties of search-form catalog fields in that they're always lists instead of single entries.

So first you apply a filter on the catalog that only the supergroup entries can be selected. Then you add an onchange handler that, when an entry is selected, changes the filter to only allow the leafentries for that supergroup and then set the value of the catalog field to a list filled with all the leafentries.

That way, when you select a supergroup, you would then have all the leafentries of that supergroup in the catalog field and when searching, it will look for all objects that have any of those leafentries, which should be would you're looking for.

Of course you would need to add a part that when you clear the catalog field it would restore the filter that only shows the supergroups.

Note that this only works for search forms. In create and edit forms this wouldn't work as catalog field would be single entries and not multi entries.

Hope that helps.

0 votes
by (1.2k points)

Is the property ‚isAllElementsSelectable‘ of the code system set to true? Only if this property is true, you can persist the inner entries (knodes).
You search for term "Unterhaltungselektronik", but you have a field with "Unterhaltungselektonik/Tonaufzeichungsgeräte". Tne index data search is an exact search. You cann’t find a part oft the term.
Suggestion: Therefore you may script within the search form. If the user selects a knode the onchange script should append all the leaves of the knode. So every correspondig objects are found.

by (19.2k points)
Additional information: We are checking whether we can search internally with '*' in the case a knode was selected, so that the objects containing the leafs of the knode will be find as well.
by (19.2k points)
edited by
Bad nesw: search with '*' does not work for catalog fields. May be a knode-based search by including all leaves may work ...

Related questions

...