SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written a web part that generates several KPIs based off a list given: - List and column names placed in custom configuration values - Parameters at run time

Each KPI is composed from a set of list rows dependent on the KPI and parameters. I.e., KPI 1 can be calculated from rows 1, 2 and 3 while KPI 2 can be calculated from rows 2, 4 and 6.

I want to be able to click on one of the KPI's and filter the list by the ID's that were used to calculate the KPI. The only solution I've found is to create a CAML statement with a List View Web Part but some KPI's will have up to a 1,000 records making the generated CAML statements pretty huge.

Ex. CAML with 3 records

<fieldref name="ID">
<value type="Counter">1</value>
<fieldref name="ID">
<value type="Counter">2</value>
<fieldref name="ID">
<value type="Counter">3</value>


Is there a more efficient way to do this. I simply want to get all the rows that made up each KPI. Preferably using the List View Web Part so the user can further filter and sort as they wish.

share|improve this question
up vote 1 down vote accepted

I'd add a choice field to the list indication which KPIs it was part of (allowing multiple selections) and the checks for that choice field in the query (Eq works as long as value is one of the selected choices)

But if your only option is to query based on the IDs then using the <In> element is your best option like:

   <fieldref name="ID"> 
    <Value type="Counter">1</Value> 
    <Value type="Counter">2</Value> 
    <Value type="Counter">3</Value> 
share|improve this answer
Thanks for this but I don't know what KPI the row will be in until run time. Its dependent on attribute values like status and the date an action happened combined with business logic that's not captured in the list. – RWL01 Mar 23 '12 at 13:14
Added option based on that info to my answer – Per Jakobsen Mar 23 '12 at 14:18
That's exactly what I was looking for, thanks. – RWL01 Mar 23 '12 at 15:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.