The collapse statement hides the detail records associated with the currently active summary record.
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
|10.0||No Change||Carried over from Panorama 6.0.|