How to summarize in VFP, average, maximum and small value. How to sort it? What are their corresponding commands?

1 thought on “How to summarize in VFP, average, maximum and small value. How to sort it? What are their corresponding commands?”

  1. Calculating command
    The financial and statistical operations on the fields in the table or the expression containing fields.

    calculating [scope] [for] [While]
    [to varlist | to array arrayName] []
    [in nWORKAREA |]
    n parameter n parameters n parameter n parameters n parameter n R n
    specifies the expression. This expression can contain any combination of the following functions: avg () cNT () or count () min () min () npv (, [,]) std () sum ) Var (), use the function in a comma -separated expression list. These functions are only used for the Calculating command, and these functions will be explained in detail after this section. Do not confuse independent functions with similar names. For example, the call min () is different from min ().
    scope
    The range of records used in the specified calculation. Only records within the scope can be calculated. Scope clauses include: all, next nrecords, record, and rest. For more information, see the scope clause. Commands containing scope clauses can only be operated on the table in the activity area. The default range of the Calc turned command is all records (ALL).
    FOR
    The specification to be calculated only with records that meet logical conditions. In the calculation, the contains of the for clause can have conditional selection records to screen out the unwanted records. If it is an optimized expression, the Rushmore query optimization will optimize the Calculating … for. In order to obtain the best performance, you should use the optimized expression in the for clause. For more information about the Rushmore optimization expression, see SET Optimize and use Rushmore query optimization to accelerate data access.
    While
    In specifies a condition. As long as the logical expression result is true (.t.), the record is calculated. (*Translator Note: Until the record of the first .f.)
    to varlist
    specifies one or more variables to store calculation results. If the specified memory variable does not exist, Visual FoxPro automatically creates this variable in a specified name.
    to array arrayName
    The array name of the storage calculation result. If the specified array does not exist, Visual FoxPro will automatically create this array in a specified name. If the array exists, but it does not hold all the calculation results, Visual FoxPro automatically expands the array to accommodate information. If the array is larger than required, the content of excess elements remains unchanged. The calculation results are saved to the array according to the order specified by the Calculating command.

    It prohibits using Rushmore optimization technology in CALCULATE. For more information, see Set Optimize and use Rushmore to query optimization to accelerate data access.
    avg ()
    A calculated arithmetic average. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    cnt () or count ()
    The number of records recorded in the table. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    max ()
    The maximum or latest value returned. In MAX () clauses, any character type, date type, date time type, numerical type, floating -point type, integer, dual -precision, or currency field, or any expression of these data types. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    min ()
    The minimum or earliest value returned. Among them, it can include any character type, date type, date time type, numerical type, floating -point type, integer, dual -precision, or currency field, or any effective expression using these data types. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    NPV (, [,])
    Coustically calculated a series of net cash circulation net value under a fixed period of interest rates. Specify interest rates for decimal representation. Specify fields, field expressions, or numerical expressions that represent a series of cash circulation. Each cash circulation can be negative. When it is a field, the field value of each record is considered a cash circulation. Specify an optional initial investment. If you do not include initial investment, it is assumed that the initial investment occurs at the end of the first stage. This initial investment is the first record, and it is negative, representing cash outflows. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    std ()
    The standard deviation of calculation. The standard deviation is used to measure the value of the expression or the field of expression, which deviates from the average value. The smaller the standard deviation, the less these values ​​are deviated from. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    sum ()
    Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    var ()
    It calculating the difference in the average value of. The variance is the square of the standard variance. The smaller the square difference, the less the value is deviated. Only the records that meet the requirements of SCOPE and/or optional for or whether can it include the results.
    in nWORKAREA |
    In the work area or alias of the work area affected by the Calculating command. Use this clause to specify the work areas or tables outside the current workspace.
    The n records containing NULL values ​​are not included in the operation of Calculating.

    Example
    Copy code
    Close databases
    open database (home (2) data epidata)
    use order

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top