total lines Select in form

lilianatavareslilianatavares Member Posts: 39
Hello,

I would like to know how can I add the selected lines in a form and see the total in that form. What's the trigger in form that I can use?

Thank you.

Comments

  • ric123ric123 Member Posts: 8
    i'm from porto too :P

    you just need to have a key that has the field you want to calc the sum as a SumIndexField. look at the help, its quite clear:

    CALCSUMS (Record)
    Use this function to calculate the total of a column of SumIndexFields in a C/SIDE table. Using parameters, you can tell the system exactly which fields to calculate.

    [Ok :=] Record.CALCSUMS (Field1, [Field2],...)
    Ok

    Data type: boolean

    If you omit this optional return value and if one of the fields is not a SumIndexField, a run-time error occurs. If you include a return value, the system assumes you will handle any errors.

    Record

    Data type: record

    The record that contains the SumIndexFields you want to calculate.

    Field1, Field2, ...

    Data type: decimal

    One or more decimal fields, which are defined as SumIndexFields, in the current key.

    Comments
    Use this function to total columns in a table. This function operates only on records that meet the conditions of any filters associated with the record.

    Example
    This example shows how to use the CALCSUMS function.

    "Cust. Ledger Entry".SETCURRENTKEY("Customer No.","Date");
    "Cust. Ledger Entry".SETRANGE("Customer No.", 'AAA 1050');
    "Cust. Ledger Entry".SETRANGE("Date", 010196D, 123196D);
    "Cust. Ledger Entry".CALCSUMS("Amount");

    The first line selects a key. The second and third lines set filters for the fields Customer No. and Date in the Cust. Ledger Entry record so the total is only calculated within the specified range. The CALCSUMS function then finds the net change in account AAA 1050 for 1996. The Amount field will show the result of the calculation.
Sign In or Register to comment.