Single category(Category Filter) in Xpages:
- Create a view with first column "sorted"(let me call the view as "xview")
- Create an Xpage
- Create a combo box in the Xpage and write the code to get the value of 1st column of the created view(xview)
- Create a view control and map the newly created view (xview)
- Neglect the 1st column in the displaying of view, since we don't need that.
- Select the "CategoryFilter" Property and give the code "sessionScope.get("urchoice");" //This line of code is getting the value of the session scope variable and set the views property inorder to show the Single Category value from view.
- Now write the code in the "combobox" in the onclick / on change and code the script "sessionScope.set("urchoice",getComponent("comboBox1").getValue()); //This line will get the selected value of the combobox and set in the sessionscope variable.
- Now run the Xpages and see the "ShowSingleCategory" in the Xpages.
How can we create a Double Category that means filtering the view with Two Field values:
- Remember to index the database first
- Create a view with first and second column "sorted"(let me call the view as "xview")
- Create an Xpage
- Create two combo box(s) in the Xpage and write the code to get the value of 1st column in the first combobox and 2nd in the second combobox of the created view(xview)
- Create a view control and map the newly created view (xview)
- Neglect the 1st 2 columns in displaying of view, since we don't need that.
- Now create a Button in the Xpage called "Go" or "Submit", change the Button type to "Submit" (from properties)
- Tie up the combobox value with the session scope and give the variable name (need to do for both combobox)
- Select the view and select the "Search" (from properties) and write the code to get the correct documents in the view
This is a workaround for the double Filtering in the Xpage. This is a solution for the search also in Xpages.