Ticket T1279747
Visible to All Users

How to calculate a difference between two columns in XRCrossTab

created 3 days ago (modified 2 days ago)

[DevExpress Support Team: CLONED FROM T1279152: XtraReport - Display overview of all found nested groups AFTER displaying the details for these nested groups]

Just note: I create the report definitions by C# code on my own but in case of troubles I can export it to WYSIWYG editor, find the solution and then to project found solution to my code.

My current result is this summary table:
Clipboard-File-1.png

Issue 1) The column DIFFERENCE should contain the difference of NORM and WORKED columns for each row. But I don't know how to define the summarization value like sumSum(WORKED) - sumSum(NORM).
The workaround could be to define auxiliary field in the data source where I can calculate the difference for every row so the sumSum over this auxiliary column could do the trick. Or maybe I could define auxiliary CalculatedField in the report?

The desired result is something like this:
Clipboard-File-2.png

Thank you very much. I know I have a lot of questions. :-)
M.

Answers approved by DevExpress Support

created 2 days ago

Hello Miroslav,

From what I gather, you created calculated fields and try to change their expressions to achieve your goal.

You are on the right track. You just need to move your formulas from calculated fields to the Text property's expression of CrossTab's cells. I recorded a video to demonstrate how to do this.

Best regards,
Aleksandr

    Comments (2)
    MA MA
    Miroslav Ambros 2 days ago

      Thank you, setting the Text property's expression of CrossTab's cells solves the problem.

      My code:
      crossTab.Cells[3, 2].ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "[DZ005]-[VYKON]"));

      If I understand it well the designer and its Expression Editor offers me only those fields which are available in the context of the selected cell.
      For the XRCrossTabCell these are the values from the cross tab.
      For the XRTableCell these are the values from the underlying data source.
      Thanks.
      M.

      Aleksandr (DevExpress Support) 2 days ago

        Thank you for the update and for sharing your code. It looks correct to me.

        Regarding your question about the expression scope, I confirm that regular bands and cross-tab controls use different scopes, as you described.

        I hope you find this information helpful.

        Best regards,
        Aleksandr

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.