collapse
collapse

The collapse statement hides the detail records associated with the currently active summary record.

Parameters

No parameters.

Description

This statement collapses any detail records associated with the current summary record. The records become temporarily invisible, but they are not removed from the database. They can be revealed later using the expand or expandall statements, or the outlinelevel statement.

This example totals a numeric field called Expenses and writes the answer to a summary record created by the total statement, then goes to that summary record, and collapses the database to see just that summary record.

    field Expenses
    total
    lastrecord
    collapse

This example groups a database by the GLCategory field, totals the Balance field and then checks record by record, collapsing the records when it finds a level 1 summary record only.

    field GLCategory
    groupup
    field Balance
    total
    firstrecord
    loop
        if info("summary") =1
            collapse
        endif
       downrecord
    until info("stopped")

Note: The previous example could be simplified and made to run faster by using the outlinelevel statement.

    field GLCategory
    groupup
    field Balance
    total
    outlinelevel 1

This example uses the collapse, expand, and expandall statements in a procedure to calculate percentages of Balance values for each data record associated with a specific summary 1 record for that group.

    local BalTotal
    field GLCategory
    groupup
    field Balance
    total
    outlinelevel 1
    firstrecord
    field Percentage
    loop
        if info("summary") =1
            BalTotal = Balance
            expand
            formulafill (Balance/BalTotal)*100
            collapse
        endif
       downrecord
    until info("eof") or info("summary") >1
    lastrecord
    fill Percentage
    fill "100"
    Percentage = zeroblank(0)
    expandall

See Also

- analyzedialog -- opens the standard Analyze dialog.
- average -- calculates averages and sub-averages for the selected records in the current field.
- collapsetosummary -- collapses to the next higher summary level.
- count -- counts all non-empty data cells for the current field.
- expand -- reveals the next level of collapsed detail records associated with the currently active summary record.
- expandall -- reveals all collapsed detail records associated with the currently active summary record.
- groupdown -- divides the database into groups, with a summary record at the end of each group. The groups are arranged in descending order (high to low).
- groupup -- divides the database into groups, with a summary record at the end of each group. The groups are arranged in ascending order (low to high).
- info("collapsible") -- checks to see if the current record is collapsible.
- info("expandable") -- checks to see if the current record is expandable.
- maximum -- calculates the maximum and sub-maximums for the current field.
- minimum -- calculates the minimum and sub-minimums for the current field.
- removeallsummaries -- removes all summary records.
- removedetail -- removes data records from the current database, leaving only summary records. It can also delete low level summary records, leaving only higher levels.
- removesummaries -- removes summary records from the current database.
- total -- calculates totals and subtotals for the current field.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.