Grouping without sorting

In Pano 6 I frequently use the Group function to create summary records at each value change in the column I’m grouping. In Pano X, I do not see a way group without sorting. Hopefully I’m missing something obvious.


There is no way to group without sorting, and I’m not planning to add that. The way this code works in Panorama X it would require a complete rewrite to group without also sorting, and that feature was almost never used. You are the first person to ask about this in he two years since people have been using Panorama X.

I continue to use it a lot on my older Mac w/ Pano 6 build 91236, great for
grouping time generated information combined with counting, and for some
stock market studies, plus some accounting I did for my puzzle business.

Having the ability to procedurally create Summary records means that a user could create a customized GroupUp for an ‘Unsorted Field’

Something like this

Local LCurrentRecordValue
LCurrentRecordValue = «Unsorted Field»
If «Unsorted Field» ≠ LCurrentRecordValue
    SummaryLevel 1
    LCurrentRecordValue = «Unsorted Field»
Until Info("Stopped") = 'True'
SummaryLevel 1
Field «Unsorted Field» Propagate

The code above wasn’t liking the Until designating the end of the loop so the last Summary record will not be created and the Propagate won’t happen but I’m too burnt at the end of my day to figure out why. :wink: That will be yours to figure out. My Panorama X was beachballing on my code. Probably something about attempting to add that last Summary Record with the InsertBelow command.

I was kind of hoping someone would figure that out and post it :slight_smile:

However, it would be faster if the loop used a variable and findbelow. Then it wouldn’t have to loop every record. I think you could just replace downrecord with

findbelow «Unsorted Field»

and change the until to use info("found") = false()

Also, you could change «Unsorted Field» to just «» and it would work for the current field.

BTW, the problem with your until statement was that you used 'true', you should have used true().

Ok, here is a working version that uses the findbelow statement. It’s pretty fast if there aren’t too many summary records needed. It also moves the current line back to wherever it started.

startdatabasechange "allrecords"
local value, rid
value = «»
rid = info("serverrecordid")
    findbelow «» <> value
    stoploopif info("found") = false()
    summarylevel 1
    value = «»
summarylevel 1
summarylevel 2
find rid = info("serverrecordid")

Perhaps I’ll make this a statement, but I probably won’t add it to the menus.

Yep, much better.

I take offense pretty quick when I see someone post that ‘There is no way to…’ when they are speaking of Panorama. Most always, there is a way.

I tested your routine on a file with over 5000 records… took a while but worked nicely! Thank you much.

I posted a similar thread about grouping without sorting and Jim told me the same thing…no one does that. Well, I do and liked using it in Pan 6. Wouldn’t a simple way of keeping a fixed order is to create a number field and sequence the original order and then use that field to do the final group up at the end? I would think that process would run extremely fast, no matter how many records there were.

I do use sequence fields in some cases when I want to restore an order.
Frequently though when grouping without sorting, the file is a throw-away
file on which I’m doing temporary work and sequencing is irrelevant.

In Pan 6, I used to use, “Group without sorting”, all the time, but I never told anyone!