This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 29, 2014, 10:50 PM
13 Posts
topic has been resolvedResolved

Restricting a View to Multiple Categories

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: xpages
  • Replies: 4

Hi All

I want to design a view that display only projects of selected customer and services, so I created a view that customer and service columns are categorized and a view panel for this view. If I put document1.getDocument().getItemValueString("Customer")

it works with a restrict single category. How I can do this with tow categorized columns(or filter view with two field value).

Thanks in advance

Oct 30, 2014, 11:22 AM
586 Posts
hmmm

I don't think you can do what you want with the view control.  Or even the built in filtering capability of the view dataSource.

What you want to do I believe is use nested repeat controls.

The outer repeat control is your desired "categories" and the inner repeat control uses that category in a lookup to get the detail records.  

I don't have any code handy to paste but I'm sure I've covered this on some early NotesIn9's.  Googling for "Nested Repeat" might help.

 

Good Luck!
Dave

 

Oct 30, 2014, 1:39 PM
298 Posts
David is right, this is a View limitation
Even in the Notes client this does not work.

You can either use a FT Search in a view (but lose the categorization) or the nested repeats David referred to.

Howard
Oct 30, 2014, 3:22 PM
453 Posts
Well I do something like that in several instances

Create a view with a computed categorized column and make the value something like this Customer + "~" + City (or whatever your second value is). Now to create you look-up key would be something like this:

var key:String = document1.getValue("Customer") + "~" + document1.getValue("City");

Now use that value in a getDocumentsByKey() or as the filter in RepeatControl or DataView. 

Works like a charm. I use this method to create a multi level categorized repeat control all the time. It does mean a few extra views but once the view index is created I don't believe that there is a significant performance hit.

Also note you do not need to do document1.getDocument().getItemValueString("Customers") you can get it directly from document1 xsp Object and only have to do a getValue and the getValue sets the type automatically for you. Much more efficient. Here is a question I posted on StackOverFlow and got a great answer from Tim

http://stackoverflow.com/questions/18303862/which-is-the-most-efficient-way-to-access-the-value-of-a-control

Bottom line if you have the xsp document use it unless there is a compelling reason to get the Domino Document.

 

Oct 31, 2014, 9:51 PM
14 Posts
Yes, what Bill Fox said.

You can add more stuff to the single-category.

If you can keep the number of categories within view limits, you can also permute through the possible combinations, but -- this only works with a nominal amount of categories. So if you have a few dozen customers, then it'll work. If you have hundreds, it will quickly outstrip the ability of the view to handle all the categories.

In any event, look up formula's "permute" operator: *+ . I've found it very useful when these "oh, I want to combine things every which way" requirements come up.

It's also possible to halve the number of categories by stripping out the entries that're non-alphabetical. That operation though is not easy, so see if it'll fit what you're doing, before optimizing.

Combining more than two, requires that many more permutations.

Also, it may be you can satisfy the need without displaying multiple customers. But we'd need to know more about what you're trying to accomplish (e.g. maybe a customer had a name-change, in which case an "old names" field would be worth categorizing as well). There might be another way to handle the actual task, and get your users' need satisfied another way.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal