web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Group Wise Sum of only visible rows

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I want to Group Wise Sum of only visible rows . I have written the below code but not working . It is summing Hidden Rows value also.

=SUM(IIF(Fields!OQty.Value = 0 and Fields!RQty.Value = 0,NOTHING,Fields!UQty.Value))

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    CristianAguerre Profile Picture
    147 on at
    RE: Group Wise Sum of only visible rows

    Hi jsshivalik,

    Other option is do it by code but in the Report layout.

    Property report -> code

    Create 2 function, and a global variable. One function sum in the variable the value passed and the second function returns the value of the variable.

    Example:

    Shared SumVar as double

    Public Function SumValuea(Num as Integer) as Object

    SumVar += Num

    End If

    Public Function GetValue() as double

    return SumVar;

    End if

    I don't test the code is only for example, the syntax can be wrong.

    Then when you have create the function in the row of the report (in the last column for example) you add in expression the call a you function to SUM. The visibility rule of your row is execute before then only when the visibility is true the row call your function and only SUM the correct values.

    Then when you want to get the value SUM only call the function GetValue().

    Of course you can do it the function SumValue the return always TRUE and set the call to the function in the hiddenvisibility expression to hide the function call.

    Public Function SumValuea(Num as Integer) as Object

    SumVar += Num

    return true;

    End If

    Regards!

  • jsshivalik Profile Picture
    3,099 on at
    RE: Group Wise Sum of only visible rows

    Hi

     Isn't it possible in report. In coding i may have to make lot of changes

    Thanks

  • Suggested answer
    CristianAguerre Profile Picture
    147 on at
    RE: Group Wise Sum of only visible rows

    Hi,

    I suppose you are doing the visibility row from some condition, if is correct my suppose then i suggest

    Calculate the values in the code, OnAfterGetRecord applying the conditions and sum in a variable, then pass the variable a the layout. Example:

    IF ConditionVisibility THEN

       varToSum += record.value;

    Don't forgive clear the variable when you want restar the sum.

    Regards.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans