Simple Calculation

I have a simple report which brings through some sales prices and totals from a SQL database. This all works fine but I want to calculate the ex VAT price in the report
The current Text field is [Report_printInvoices.SalePrice] and this shows for each data line.
Now I want this value divided by 1.2 but just get an error or the value and then / 1.2 as text
I assume I am missing something really simple but can't see it. - I was expecting to just type [Report_printInvoices.SalePrice] / 1.2

Comments

  • edited 4:30AM
    Hello,

    You forgot to enclose whole expression in the brackets:
    [[Report_printInvoices.SalePrice] / 1.2]
  • edited 4:30AM
    I'm having similar issue try to write the similar expression but give me the error
    [
    [qryCompletedVisits.Jan]/[[qryTotalVisitsAssigned.Jan]-[qryCancelledVisits_testing.Jan]]
    ]
    
    Also tried like this 
    [[qryCompletedVisits.Jan]/[[qryTotalVisitsAssigned.Jan]-[qryCancelledVisits_testing.Jan]]]
    

    Error
    wrote:
    Cell123: Error BC30023: Bracketed identifier is missing closing ']'
    Function: Error 40005: function 'ToString' shadows an overrideable method in the base class 'Object'. To override the base method must be declare 'override....'
    Thanks for your help in advance
  • edited January 2018
    Farhan wrote: »
    I'm having similar issue try to write the similar expression but give me the error
    [
    [qryCompletedVisits.Jan]/[[qryTotalVisitsAssigned.Jan]-[qryCancelledVisits_testing.Jan]]
    ]
    
    Also tried like this 
    [[qryCompletedVisits.Jan]/[[qryTotalVisitsAssigned.Jan]-[qryCancelledVisits_testing.Jan]]]
    

    Error
    Farhan wrote: »
    Cell123: Error BC30023: Bracketed identifier is missing closing ']'
    Function: Error 40005: function 'ToString' shadows an overrideable method in the base class 'Object'. To override the base method must be declare 'override....'
    Thanks for your help in advance

    Resolved after playing with that use curly brackets
    [[qryCompletedVisits.Jan]/([qryTotalVisitsAssigned.Jan]-[qryCancelledVisits_testing.Jan])]
    

    after use the above calculation as aim to see the %Achieve simply change the format of the field to to % with two decimal points and display as expected
    Thanks
    Thanks
  • edited 4:30AM
    for complex calculation, use script as custom function
    namespace FastReport
    {
      public class ReportScript
      {
        public double CustomFunction(double a, double b, double c)
        {                 
            return a / (b - c);
        }
      }
    }
    

    in your textobject:
    [CustomFunction([qryCompletedVisits.Jan],[qryTotalVisitsAssigned.Jan],[qryCancelledVisits_testing.Jan])]
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.