1 2 Previous Next 20 Replies Latest reply on Aug 1, 2017 6:00 PM by tinhx7

    Need Help with: Select Sum

    tinhx7

      Hi guys,

       

      I'm try to create a sum base on this conditions in my Line Items table from Invoices.

      Invoice Payment Type : Cash  = Total

                             Credit = Credit Charge

                             Split = Tender , Credit Charge

       

      -----------------------------------------------------------------------------

      I wrote the formula that base on the invoice ID that populate in Line Item table for Cash, but it didn't work.

      If payment type is Cash, then total the sum of Total.

      If payment type is Split, then total the sum of Tender and Credit Charge.

       

       

      Let (

      theArray = Substitute ( S_InvoiceID_FK_List ; Char(13) ; "," ) ;

      ExecuteSQL ( "

      SELECT SUM ( Invoices.Total),Sum (Invoices.Tender)

      FROM Invoices

      WHERE Invoices.ID IN (" & theArray & ") AND Invoices.Payment Type = \"Cash\" OR Invoices.Payment Type = \"Split\" " ; "" ; ""))

        1 2 Previous Next