General discussion


Variables in Reporting Services

By gochris01 ·
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:

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by ziqbalbh In reply to Variables in Reporting Se ...


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


Collapse -

Order of Processing

by muellerkyle In reply to Variables in Reporting Se ...

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, "<DataSourceName>") <> 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.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums