Discussion Locked

Variables in Reporting Services

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am calling the AddTime function successfully in the detail section a table on my MS Reporting Services report. When I try to access this value using the GetMyTime function from the footer section of that same table, it comes back empty. Any ideas?

Thanks, Chris

-------------------
Begin Code:
-------------------

Public lTimeTot as Long

Public Function AddTime() as Long
lTimeTot = lTimeTot + 86400
AddTime = lTimeTot
End Function

Public Function GetMyTime() as Long
GetMyTime = lTimeTot
End Function

-------------------
End Code:
-------------------

2 replies

by ziqbalbh

Hi,

One solution is to make lTimeTot static / shared. That would solve this problem.

Regards

by muellerkyle

I know this question is old, but I wanted to answer it for the sake of posterity.

The reason that you get an empty value is that Reporting Services, as of SQL 2005, processes the Group headers / footers before it processes the Detail of the report.

The best possible work around for this behavior right now is to create rows in your detail section and hide them until the proper row is reached by using an expression in the "Visiblity" property for the detail row. For instance, to show the detail summary row for a list of employees (Where EmployeeID is the PK value for the employee rows), use the following Formula for the Visibility property of you summary row (A detail row in the report.)

Last(Fields!EmployeeID.Value, "") <> Fields!EmployeeID.Value

In that row, call your GetMyTime Function and it should now return data if you were setting lTimeTot in your other detail rows.

This discussion is closed to new replies.