Reputation: 111
I have an Rdlc report In this report I have a field which takes its values by this expression
(Round(((First(Fields!Occurs.Value) / First(Fields!TotalDistance.Value))* 10000),2)
but in some cases (TotalDistance.Value) = 0 so the previous expression returns Infinity, So I need to get the next record in case of that field equals 0 , If also next field equals 0 , I want to get the next one
I looked for way of getting next record but didn't find I only found (First , Last) methods, How can I do that ?
Upvotes: 1
Views: 2972
Reputation: 3773
instead of using First or Last if you don't care which record as long as it isn't 0 then couldn't you use an aggregate function. ex:
(Round(((First(Fields!Occurs.Value) / MAX(Fields!TotalDistance.Value))* 10000),2)
you could use Max, Min or Avg to get a value. I am unaware of any way within the rdlc to loop through the records like you are asking.
Another completely different way could be to load the data into a datatable then add a column to contain the calculated value and use some code to calculate the values before being passed to the report.
Upvotes: 2