Method Community

 

Report Designer - calculated fields

Last post 10-10-2018 3:03 PM by Method_Inderdeep. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 09-22-2011 10:39 AM

    Report Designer - calculated fields

    I have a report with Total Profit (calculated) and Total Actual Man Hours (calculated).  How to I set up a calculation for:

    Total Profit/Total Actual Man Hours

  • 09-22-2011 11:07 AM In reply to

    Re: Report Designer - calculated fields

    JKM@SA,

    Where is Total Profit and Total Actual Man Hours calculated? Are they stored in the table in the calculated format?

    -Michael

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
  • 09-22-2011 11:19 AM In reply to

    Re: Report Designer - calculated fields

    Total Profit is in the table in a calculated format.  Total Actual Man Hours is just a sum on the report.

  • 09-22-2011 11:51 AM In reply to

    Re: Report Designer - calculated fields

    JKM@SA,

    Take note of the actual names of the labels you are using to display the fields you want to use in your calculation. (Click on the labels and in the property grid look for (name).)

    Create a new label and in the property grid go to Scripts > Before Print and click ... , this will being up a windows where you can enter a script

    Enter the following between the 2 lines of existing code:

    ctype(sender,xrLabel).Text = Microsoft.VisualBasic.Format(label5.Text / label6.Text,"$#,##0.00###")

    You will need to replace label5 and label6 with the names of the labels for the fields you are using.

    For those you want to know what the script is doing:

    ctype(sender,xrLabel): Refers to the label calling the script

    Microsoft.VisualBasic.Format(value,"$#,##0.00###"): Applies a currency format to value.

    -Michael 

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
  • 09-22-2011 12:50 PM In reply to

    Re: Report Designer - calculated fields

    I am getting an error message.  Here is what I entered:

     

    Private Sub OnBeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)

    ctype(sender,xrLabel).Text=Microsoft.VisualBasic.Format

    (xrLabel13.Text/label2.Text,"$#,##0.00###")

    End Sub

     

     

    I am getting the following error message:

    There are the following errors in script(s):

    label3.OnBeforePrint,line 2: error BC30455: Argument not specified for parameter 'Expression' of Public Function Format(Expression As Object,[Style As String = "]) As String'.

    label3.OnBeforePrint, line 3: error BC30035: Syntax error.

  • 09-22-2011 2:14 PM In reply to

    Re: Report Designer - calculated fields

    Answer

    JKM@SA,

    The line of code I gave you has to be all on the same line and not on 2 seperate lines. If you are still having issues, I would suggest looking at some of the field on the Estimate templates(They have a simlair setup) or booking some consulting time.

    -Michael

    Michael Melo
    Product Manager
    Method Integration Inc.
    Website: http://www.method.me
    LinkedIn: http://www.linkedin.com/in/MichaelMelo
  • 02-28-2012 7:43 PM In reply to

    Re: Report Designer - calculated fields

    I need to calculate to labels together to give me a total in a new label.  I followed the above coding and it took one label and divided by the 2nd label.  I need it to add them together.  What coding would I use for that.  I assume i need to subsitute the / with a + but when I did that it just showed me $#,##0.00###".

    Sue Nissel
    Advanced QB Certified ProAdvisor
    AccuBusiness Solutions, Inc.
  • 10-10-2018 12:51 PM In reply to

    Re: Report Designer - calculated fields

    I have been trying to get scripts to work in the report designer and I keep getting weird results.

    I followed your example above and created the following script where label28 is new label I added to the group foote2 and label33 is a label that is a summary in group footer 2 and is bound  to InvQty in the table I am using for this report.

    Private Sub OnBeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)

    ctype(sender,xrLabel).Text = Microsoft.VisualBasic.Format(label33.Text,"##0.00")

    End Sub

    What shows up on the report is    ##0.00

    Any idea waht I am doing wrong?


    Stuart Katz
    Noggin Builders
    Let your children come explore the wonders!
  • 10-10-2018 3:03 PM In reply to

    Re: Report Designer - calculated fields

    Hi StuartKatz,

    Do you mind letting me know the end result that you are trying to achieve and what are the fields you are working with and on which report? It will help us in narrowing the issue.


    -Inder

  • 10-10-2018 3:03 PM In reply to

    Re: Report Designer - calculated fields

    Hi StuartKatz,

    Do you mind letting me know the end result that you are trying to achieve and what are the fields you are working with and on which report? It will help us in narrowing the issue.


    -Inder

Page 1 of 1 (10 items)