Print Page | Close Window

Cant Sum Up!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=17296
Printed Date: 03 December 2024 at 12:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Cant Sum Up!
Posted By: JamGodz
Subject: Cant Sum Up!
Date Posted: 22 September 2010 at 7:34am
Hi Everyone!

If item had a comma it wont sum up... is this a limitation?Cry






Replies:
Posted By: Aaron
Date Posted: 22 September 2010 at 8:05am
Hi,
 
Yes, it is but already added this to my list.
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JamGodz
Date Posted: 22 September 2010 at 9:28am
Thanks Aaron!


Posted By: JamGodz
Date Posted: 10 January 2011 at 8:12pm
Hi Aaron! Good Day! and Happy New Year!

How's the comma in Sum? is it implemented in new release? tnx


Posted By: jpbro
Date Posted: 10 January 2011 at 10:09pm
Strangely, it appears that the GroupFormula uses the Item.Caption property instead of the Item.Value property, which makes no sense to me, since I thought you would use Item.Value to store the "real" value of an Item, and the Caption property to store the value formatted for display purposes.

For example, I would have hoped that this would work:


Set xRecord = wndReport.Records.Add
With xRecord.AddItem(CCur("10,000"))
   .Caption = Format$(.Value, "#,##0.00")
End With


But because the SUMSUB formula uses the Caption property for its calculations, it fails.

Instead you have to jump through hoops with BeforeDrawRow and Metrics.Text (but it then does work as expected):


Option Explicit

Private Sub Form_Load()
   With Me.ReportControl1
      With .Columns.Add(.Columns.Count, "Test", 100, True)
         .Groupable = True
      End With
      With .Columns.Add(.Columns.Count, "Test", 100, True)
         .Alignment = xtpAlignmentRight
      End With
     
      .ShowGroupBox = True
      .HideColumnAfterGroupBoxDrop = False
     
      .SetCustomDraw xtpCustomBeforeDrawRow
     
      With .Records.Add
         .AddItem "G1"
         .AddItem CCur("10000")
      End With
      With .Records.Add
         .AddItem "G1"
         .AddItem CCur("10,020.22")
      End With
      With .Records.Add
         .AddItem "G2"
         .AddItem CCur("1000")
      End With
     
      .GroupsOrder.Add .Columns(0)
      .Populate
     
      ReportControl1_GroupOrderChangedEx .Columns(0), xtpReportColumnGroupOrderChanged
   End With
End Sub

Private Sub ReportControl1_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
   If Not Row.GroupRow Then
      If Item.Index = 1 Then
         Metrics.Text = Format$(Item.Value, "#,##0.00")
      End If
   End If
End Sub

Private Sub ReportControl1_GroupOrderChangedEx(ByVal Column As XtremeReportControl.IReportColumn, ByVal Reason As XtremeReportControl.XTPReportColumnOrderChangedReason)
   Dim lo_Row As ReportRow
   Dim lo_GroupRow As ReportGroupRow
  
   For Each lo_Row In Me.ReportControl1.Rows
      If lo_Row.GroupRow Then
         Set lo_GroupRow = lo_Row
        
         lo_GroupRow.GroupFormula = "SUMSUB(R*C1:R*C2)"
         lo_GroupRow.GroupFormat = "Total: %.02f"
         lo_GroupRow.GroupCaption = "x"
      End If
   Next lo_Row
  
End Sub


Is there a good reason why the formulas should use the Caption property instead of the Value property? Or am I doing something wrong?


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: JamGodz
Date Posted: 01 March 2011 at 8:20pm
is this available in version 15?


Posted By: JamGodz
Date Posted: 07 March 2011 at 7:29pm
Hi Aaron... just would like to know the update of this... is this incorporate to the new release(v15)?


Posted By: Aaron
Date Posted: 09 March 2011 at 4:22pm

Hi,

I tried with some sample and I'm able to assign values like 13,6 or 13.6 and both values are calculated in GroupFormula the right way.

btw I tried with V15.0.2
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JamGodz
Date Posted: 10 March 2011 at 9:06pm
Hi Aaron,

Thank you for your reply... how about the "Total in Footer"?

thanks.


Posted By: Aaron
Date Posted: 11 March 2011 at 1:26am
Originally posted by Aaron Aaron wrote:

Hi,

I tried with some sample and I'm able to assign values like 13,6 or 13.6 and both values are calculated in GroupFormula the right way.

btw I tried with V15.0.2
 
 
 
Hi,
 
I looked at topmost post and saw that you use a comma for thousand separator and you expect the formula would calculate it as "ten thousand" ???  
 
I said it is working but I didn't know what you ment, sorry. 
 
About footer, I didn't test it but I don't think it's implemeted yet. Surely CJ would add something to release notes if they had...
 
Good luck Wink
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net