Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 whileprintingrecords equivalent or workaround?

Author  Topic 

chrpeter
Starting Member

31 Posts

Posted - 2008-04-10 : 18:08:45
I'm converting crystal reports to SSRS reports right now and came across this function that I'm not familiar with.
It's a formula field in crystal that has this formula:

quote:
whileprintingrecords;
NumberVar RTCurrent;
NumberVar RT31to60;
NumberVar RT61to90;
NumberVar RT91to120;
NumberVar RTOver120;
if {@AgedDays} < 31 then RTCurrent := RTCurrent + {@BalanceDue} else
if ({@AgedDays} > 30 and {@AgedDays} < 61) then RT31to60 := RT31to60 + {@BalanceDue} else
if ({@AgedDays} > 60 and {@AgedDays} < 91) then RT61to90 := RT61to90 + {@BalanceDue} else
if ({@AgedDays} > 90 and {@AgedDays} < 121) then RT91to120 := RT91to120 + {@BalanceDue} else
if {@AgedDays} > 120 then RTOver120 := RTOver120 + {@BalanceDue}


@Aged days is just an integer, but that shouldn't matter for this thread.

Is there just a While loop equivalent for this in SSRS?

chrpeter
Starting Member

31 Posts

Posted - 2008-04-11 : 10:55:09
I think I have a work around for this. I'll just create a second dataset and get the info that way. I'll let everyone know how that works out.
Go to Top of Page

chrpeter
Starting Member

31 Posts

Posted - 2008-06-10 : 13:10:32
UPDATE:
My workaround for this is a nested SUM/IIF Statement:
=SUM(IIf(Fields!AgedDays.Value < 31,Fields!amount.value,0.0),"TableGrouping1"))
AgedDays is a calculated field that subtracts a static date(say a document date) from the current date. So if the document is under 31 days old, add it to the sum, otherwise add 0 to the sum.

For the other totals just change the IIF Statement(IE. 31 to 60 days would be "Fields!AgedDays.Value > 30 AND Fields!AgedDays.Value < 60"

Go to Top of Page
   

- Advertisement -