Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I'm using the pivot grid control along with a query tool that the end user will use to create a sql statement that gets excuted and returned as a datatable. So we are unable to format the pivot grid at design time. The issue I have is that one of the possible fields returned is a decimal(9,4) data type wich when placed in the Grand Total (or any total field) it is treated as currancy, how can I have the Total fields treat this differntly?

                                    please see attached images.

                                FieldasDecimal.JPG
                                You must  log in  or  register  to leave comments

                                2 Solutions

                                Creation Date Rating Importance Sort by
                                0

                                I was able to do what I needed by changing my method

                                [VB.NET]
                                Private Sub UpdateGridTypes() For Each field As PivotGridField In adhocpivotgrid.Fields If field.DataType Is GetType(Decimal) Then field.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric field.CellFormat.FormatString = "D2" field.ValueFormat.FormatType = FormatType.Numeric field.ValueFormat.FormatString = "D2" End If If field.DataType Is GetType(DateTime) Then field.GroupInterval = PivotGroupInterval.DateYear End If If field.Name.Contains("Charge") Then field.CellFormat.FormatString = "C" field.ValueFormat.FormatType = FormatType.Numeric field.ValueFormat.FormatString = "C2" End If Next field End Sub

                                • I am glad to hear that you have resolved this problem. Please feel free to contact us in case of any difficulties.

                                You must  log in  or  register  to leave comments
                                0

                                If I understand you correctly, you retrieve pivot fields from datasource at runtime. In this case it is necessary to specify field's CellFormat property after all fields are retrieved.

                                Attached is a small sample project that illustrates this approach. Try it and let me know whether or not it meets your requirements.

                                dxSample.zip
                                • Gary Lagace 02.15.2013

                                  Hi John,

                                  I created this method

                                      Private Sub UpdateGridTypes()
                                          For Each field As PivotGridField In adhocpivotgrid.Fields
                                              If field.DataType Is GetType(Decimal) Then
                                                  field.CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric
                                                  field.CellFormat.FormatString = "D2"
                                              End If
                                              If field.DataType Is GetType(DateTime) Then
                                                  field.GroupInterval = PivotGroupInterval.DateYear
                                              End If

                                              If field.Name.Contains("Charge") Then
                                                  field.CellFormat.FormatString = "C"
                                              End If

                                          Next field

                                      End Sub

                                  The issue I have is that the currency format is not present when the field is in the row area but does format correctly when it is in a summary area. See attachments.

                                • Gary Lagace 02.15.2013

                                  2nd attachment

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners