0

Formula somma ricambi di una installazione

I need to see the sum of the cost of the spare parts used for the new installation.

I do not find the formula that relates the spare parts inserted for installation and therefore gives me the sum of the spare parts of all the installations inserted.

The relationship between the tables is defined as in the image.

 

Immagine 2022-02-25 131226

How should i do?

This is the formula defined

sum((select 'Ricambi installazioni zanzare').Totale)

Thank you very much for your generous contribution!!!

1 reply

null
    • Fred
    • 2 yrs ago
    • Reported - view

    Hi Mauro -

     

    If the reference field is called 'Ricambi installazini zanzare' then you can just drop the select. So it would look something like:

     

    sum('Ricambi installazioni zanzare'.Totale)

     

    Otherwise change the name to match the reference field name. This would only work in the two tables that are linked from your picture. Since the records are linked you can use the power of Ninox to do the filtering for you.

     

    When you use a select statement you are telling Ninox to start a fresh search of the table. Which means the code your wrote is telling Ninox to grab all records in the 'Ricambi installazini zanzare' table. You have to tell Ninox how you want to filter the gathering of records. For example you would have to modify your select statement to something like:

     

    let x := this;<--this gathers the data from the current record you are on

    sum((select 'Ricambi installazioni zanzare')[field1 = x.field1].Totale)

     

    The first way is the most desirable way to gather data as select statements are slow and too many will slow down your table.

     

    Good luck and let us know how it goes.

Content aside

  • 2 yrs agoLast active
  • 1Replies
  • 54Views