How SUM values ​​from reportitems (texboxes) to more FOOTER (Group) textboxes in SSRS - reporting services?

Pavel Hemerka 20 Reputation points
2023-02-19T17:57:40.04+00:00

I need to sum values ​​from a textbox into textbox groups in SSRS. I learned that I need use Custome code and expression in footer texbox. I get right result in Group Worker (Textbox218) , but i get wrong result in second Group Workplace (Textbox276 ). Look at the picture below:

Expression in each Texboxes:

expression in Textbox289: =Code.GetValue(ReportItems!Textbox217.Value) - its OK

expression in Textbox218 (Group Worker): =formatnumber(Code.GetTotal(ReportItems!Textbox289.Value),1) & Code.ResetTotal(ReportItems!Textbox289.Value) - its OK

expression in Textbox276 (Group Workplace) =formatnumber(Code.GetTotal(ReportItems!Textbox218.Value),1) - the result is NOT OK. I get result ZERO, but I need result 18 (8,7 + 9,3)

Can any good soul give me some advice? Unfortunately, I dont know VBA very well. Its possible, for example, put a condition on the name of the textbox in the Custome code? Or some better solution? Thank you very much.

CUSTOME CODE:

Public Shared Value as decimal=1
  Public Shared Function GetValue(Item as decimal) as decimal
    value = value + item 
     return item
  End Function
  Public Shared Function GetTotal(item)
     return value
  End Function
Public Shared Function ResetTotal(item) 
value = 0
End Function 

Sum_group

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,064 questions
Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-02-20T07:38:54.8633333+00:00

    Hi @Pavel Hemerka

    I'm sorry I don't know much about VB either, I'm in charge of SSRS related issues. According to my search, it may be because grouping is interfering with your code, maybe you can refer to this link: https://social.technet.microsoft.com/Forums/office/en-US/d4a3969a-f3fc-457b-8430-733d7b590ff6/use-reportitems-to-sum-all-textboxes-in-a-tablix.

    Best regards,

    Aniya

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Pavel Hemerka 20 Reputation points
    2023-02-20T12:05:54.8966667+00:00

    Hi @Aniya Tang ,

    thank you for your attention and answer. I already read the given link before posting my question, but unfortunately it doesnt solve probably my problem. Maybe I just don't understand it. I tried it, but without success.

    Pavel

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.