2 Replies Latest reply on Jun 10, 2016 6:13 AM by user26750

    Help with a calculation

    user26750

      I'm currently trying to train myself to learn some new stuff with the calculation system and caught something I didn't understood at all.

      From the starting solutions invoices, there's a calculations in customers that filter and calculate the total of all non-paid invoices for that customer.

      I'd like to add an additional filter to that but I really don't know how.

       

      Definir     (

          [

          customerID = RUBRIQUE CONCORDANTE ID CLIENT ;

          decimal = Debut ( Evaluation ( 1/2 ) ; 1 ) ;

          SQL = ExecuterSQL    (

                          "

                          SELECT SUM ( b.\"Total\" )

                          FROM \"Factures\" b

                          LEFT JOIN \"Clients\" a

                          ON b.\"RUBRIQUE CONCORDANTE ID CLIENT\" = a.\"RUBRIQUE CONCORDANTE ID CLIENT\"

                          WHERE b.\"RUBRIQUE CONCORDANTE ID CLIENT\" = ? AND b.\"Ordre de statut\" < 2

                          "

                          ; "" ; "" ;

                          customerID

                          )

          ] ;

       

          Si ( SQL > 0 ; Substituer ( SQL; "." ; decimal ) ; 0 )

       

          )

       

       

      I want to add a filter, to only calculate invoices that has the field "Lock" filled with "Saved"

      If someone could explain me how that calculation works, I'd appreciate it a lot!

       

      Thanks