Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Customer Account Statement report - Show closing balance in the footer

Posted on by Microsoft Employee

Hi,

I copied standard report design of customer statement report , created a customized design (which will use same DP, Controller, Contract classes) and then added a footer in it as part of customization.

I want to show a Closing balance in the footer with some big font. You can see in the below screen shot. I want to show the exact same value of this field into Footer.

When i used that in the footer, i have to use it with Aggregate function i.e. Sum()  and that is creating issue in below scenario.

I have 2 customers. 1st having balance let's say $100.  and 2nd having balance $0 (assume that it's a newly created customer and doesn't have any transactions). 

In this scenario, when i run the report only for these 2 customers, the 2nd customer would show $100 balance as well. 

Has anyone faced this? Can you please guide how to show correct value i.e. $0 for the 2nd customer who doesn't have any transactions?

CustomerStatementReport.JPG

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Customer Account Statement report - Show closing balance in the footer

    To fix this issue, I put the value of ClosingBalance field into the hidden textbox in body part using Code.SetData(Fields!ClosingBalance) in the expression and in the footer , i received that value using Code.GetData(1,1) value.

    Below are these two functions need to be put in Report Properties -> Code section.

    Shared Data1 as Object

    Shared Data2 as Object

    Shared Data3 as Object

    Public Function GetData(Num as Integer, Group as integer) as Object

    if Group = 1 then

      Return Cstr(Choose(Num, Split(Cstr(Data1),Chr(177))))

    End If

    if Group = 2 then

      Return Cstr(Choose(Num, Split(Cstr(Data2),Chr(177))))

    End If

    if Group = 3 then

      Return Cstr(Choose(Num, Split(Cstr(Data3),Chr(177))))

    End If

    End Function

    Public Function SetData(NewData as Object,Group as integer)

     If Group = 1 and NewData > "" Then

         Data1 = NewData

     End If

     If Group = 2 and NewData > "" Then

         Data2 = NewData

     End If

     If Group = 3 and NewData > "" Then

         Data3 = NewData

     End If

     Return True

    End Function

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans