Custom Code with a Loop
Hi there, so here is what I need to do. I have a group defined with child records. I want to be able to write a custom code function to search the children records of that group and look for a particular value and when found, put the value into the group header. So I need to know if it's possible to write a custom code function that allows me to loop through the child records. I know that the Lookup function will do what I want but we do not have R2 yet installed and I need to find a workaround if possible. Thanks .. Jen CampionJen Campion
January 26th, 2011 1:48pm

Hi Jen, Based on your description about the requirement, one approach to achieve it is to use conditional aggregate calculation in the group header. For example, if the dataset is like the below one: Group Amount Group1 87 Group1 45 Group1 100 Group2 75 Group2 84 Group2 95 Group3 77 Group3 100 Group3 100 Since we want to search the records of each group and look for a particular value (for example 100), and put it into the group header if it can be found, the report would look like Group Amount Group1 100 87 45 100 Group2 75 84 95 Group3 100 77 100 100 In order to achieve this, we can specify the following expression to the textbox in the group header row. The expression calculates the aggregate sum for only the Amount is “100”. So, the sum can indicate if exists the particular value for each group.Please also be aware to correct the field name and the value “100” based on your report. =IIf(Sum(IIf(Fields!Amout.Value="100",1,0))>0,"100",Nothing) If anything is unclear please feel free to ask. Thanks, Tony ChainTony Chain [MSFT] MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
January 27th, 2011 2:08am

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

Other recent topics Other recent topics