Getting A Count of Records Returned by LookupSet
I'm using SSRS 2008 R2. I need to get a count of child records to a parent. Within scope of the parent, I tried the following call: =Count(LookupSet(Fields!ID.Value, Fields!ActivityID.Value, Fields!ActivityID.Value, "ChildDataSet")) thinking this would give me a count of records in the array of values returned from the child dataset (ChildDataSet). But I get this error: Warning 3 [rsAggregateOfInvalidExpressionDataType] The Value expression for the textrun ‘Textbox28.Paragraphs[0].TextRuns[0]’ uses an aggregate function with an expression that returned a data type not valid for the aggregate function. What am I doing wrong? How can I get a count of the children in the scope of the parent? Thanks in advance.
November 17th, 2010 5:19pm

LookupSet returns an array of items so you cannot simply count them You will most likely need to pass the result of the lookupset to a custom code function such as: Function CountItems(varArray as array) as integer Dim RetVal as integer RetVal = ubound(varArray) + 1 Return RetVal End Function Call it like: =code.CountItems(LookupSet(Fields!ID.Value, Fields!ActivityID.Value, Fields!ActivityID.Value, "ChildDataSet"))Rgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 17th, 2010 9:08pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics