No, that isn’t allowed. Panorama requires that there always be at least one selected record.
If a statement in a procedure would result in zero records selected, Panorama responds by selecting ALL records (since it has no idea what subset to select). It also sets the flag for the info("empty")
and ifselect
operations. Also, if your code doesn’t use info("empty") or
ifselect`, Panorama will automatically skip any following operations that modify the database. For example, consider this code:
select Customer = "John Smith"
field Customer
formulafill upper(Customer)
If there is no John Smith in the database, all records will be selected, but the formulafill statement will be skipped. In other words, Panorama will act as if this was the code:
ifselect Customer = "John Smith"
field Customer
formulafill upper(Customer)
else
selectall
endif
Let me put this another way. The info("empty")
function will return true if the previous selection criteria matched zero records. Panorama doesn’t allow zero selected records, so it selects all, but the info("empty")
function lets you know that really it should be zero selected records.
The bug that Jim Cook is reporting is that removeallsummaries doesn’t trigger this sequence. If it turns out there are no selected records, it just continues as if everything is fine. It doesn’t select all records, it doesn’t skip following fill operations, and it doesn’t set the flag used by the info("empty")
function. More importantly, it doesn’t leave Panorama with a valid current record, so almost any subsequent operation, even accessing or modifying a single cell, is likely to crash or cause corruption.
Fortunately, the sequence to get into this state is quite unusual. It requires you to group the database, then do a selection that results in no data records being selected. I’ll bet 99.9% of users have never done that. Other than using the info("summary")
function, you’d have to really work at it to do a selection that excludes all data records but does include summary records. For now, if you do a selection while summary records are in place, I would suggest making sure you do a select all before removing summaries.