Current filter:
                                You should refresh the page.
                                  • Hi Team,
                                    I am trying to write an expression in DevExpress report expression editor, as I am newly using this expression editor so I am facing challenges to write group by query like SQL.I am trying to achieve group by two fields one is based on location and second is based on device status, for more clarification please go through the image which i attached.
                                    Please share the expression, by which I can achieve this.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Aurobinda,

                                To achieve such output, use the report's built-in data grouping functionality. Check the Group and Sort a Report's Data help topic to learn how to add groups to the report. So, just leave your report's Detail band empty or invisible to avoid drawing data rows and display table rows by using the GroupHeaderBand band. To calculate the number of Online/Offline devices per group, use the approach described in the Calculate an Aggregate Function help topic.

                                • Aurobinda Patra 11.12.2019

                                  Hi Vasily,
                                  I didn't got you points , it will good if you can give any sample query by which i can achieve my task , like how i shared in the image.

                                • Vasily (DevExpress Support) 11.12.2019

                                  Hi Aurobinda,

                                  We do not have a sample project that demonstrates how to achieve the layout demonstrated in your document. In any case, would you please clarify what difficulties you have faced while following the steps I provided in my reply above? Were you able to group the report's data and hide its Detail band? Or maybe you faced difficulties with creating expressions that should calculate the number of Online/Offline devices? In any case, feel free to share the sample project that demonstrates what you were able to achieve, so that we will be able to guide you on how to proceed with this task to get the desired output.

                                • Aurobinda Patra 11.13.2019

                                  Hi Vasily,
                                  I am  facing difficulties with writing expression.

                                • Vasily (DevExpress Support) 11.13.2019

                                  Hi Aurobinda,

                                  Thank you for your clarification. The main idea of the approach described in the Calculate an Aggregate Function help topic is to use the aggregated Count function. This function should have following format:
                                  [<Collection>][<Condition>].Count()

                                  As you wish to calculate a summary by the current report's data source, use an empty collection:
                                  [][<Condition>].Count()

                                  To calculate summary by groups, you need to filter them by your report's group field. Use the ^ specifier in the expression to get the currently processed group field ("Location" in your case):
                                  [][ [^.Location] == [Location] ].Count()

                                  Finally you need to apply one additional filter by the "Device status" column to get the count of the "Online" or "Offline" devices. For example, use the following expression to calculate number of "Online" devices:
                                  [][ [^.Location] == [Location] && [Device status] == 'Online' ].Count()

                                  Let me know whether this expression works for you.