Reputation: 1
I am trying to design a view with multiple categories, and each document can belong to multiple categories at the same time. For example, File A is in category: 1->a; 2
I can achieve this effect by specifying the columns as categories and access the document through various routes. However, I fail to specify which category the sub-categories belong to. This is what I am getting instead: 1->a; 2->a
The case doesn't seem too big of a difference but basically the view is returning every combination of the categories and the amount of entries can get very large.
I have tried to add the super category in front of the sub-category and try to filter out entries which the categories do not match the prefix of the sub-categories(e.g. 1,a), but I cannot find a way filter them out. Although the multiple values are shown in different entries, when I try to use the variable it extracts all the values.
Is there a way I can filter the entries based on that particular row instead of all the values? Or is there anyway I can achieve the effect through other methods? Thank you in advance.
Upvotes: 0
Views: 981
Reputation: 20384
You need to collapse Categories and subcategories into a single field. The Domino way to do this is to separate category and subcategory by backslash. So your category field would be something like:
"1\a":"2"
That ties the subcategory to the category. Or if you want to be able to find a document by subcategory only:
"1\a":"a":"2"
You then can use a little formula magic to get from the subcategory back to the main category (presuming the subcategories don't duplicate):
AllCategories := "1\a":"a":"2";
foundCategory := "a";
@Trim(@Replace(AllCategories;foundCategory:@Trim(@ReplaceSubstring(allCategories;foundCategory)));
This would return "1\a"
(Note: the formula above is written is classic @Formula language, it is left as an exercise to the reader to translate that to the JavaScript formula equivalent)
Hope that helps
Upvotes: 2