0

sum( where) help needed

I have a table named "Tax" which has a single user entered field named "Year" and then a number of formula fields that are supposed to collect data from other tables (Invoices, Expenses etc) in the database and carry out the appropriate calculations.

 

For example, the first ƒx field in "Tax" is "Income"

when I have the formula:

1. let xYear := year;         // I know I don't need this yet// 

2. sum((select Invoices).'Grand Total')

This works perfectly to give the total of all the invoices in the database.

The problem comes when I try filtering the the results by year.

I have tried this:

1. let xYear := year;
2. sum((select Invoices).'Grand Total' where year('Invoice Date') := xYear).'Grand Total');

I copied the structure from the ninox manual but I get an error message "Symbol expected: , at line 2, column 41"

 

I'm sure it's just a syntax error but I can't work it out.

Thanks in advance for the help. 

4 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Michael Chung

    let xYear := year;
    sum((select Invoices where year('Invoice Date') = xYear).'Grand Total')

    I suppose year is a numberfield? If not then you might want to use todays year? Then use -     let xYear := year(today());      -instead.

    Steven

      • Michael_Chung
      • 2 yrs ago
      • Reported - view

      RoSoft_Steven Rooryck 

      Thanks for the help but no luck.

      I'm now getting the error "Symbol expected: ")" at line 2 , column 50

      Year is a number field.

    • Michael_Chung
    • 2 yrs ago
    • Reported - view

    Worked it out. I was using := instead of =

      • Ninox partner
      • RoSoft_Steven.1
      • 2 yrs ago
      • Reported - view

      👍

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 188Views
  • 2 Following