General discussion

  • Creator
    Topic
  • #2180035

    Variables in Reporting Services

    Locked

    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:
    ——————-

All Comments

  • Author
    Replies
    • #3164219

      Reply To: Variables in Reporting Services

      by ziqbalbh ·

      In reply to Variables in Reporting Services

      Hi,

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

      Regards

    • #2523775

      Order of Processing

      by muellerkyle ·

      In reply to Variables in Reporting Services

      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.

Viewing 1 reply thread