Can't expand or modify outline level & Crashing with attempts to Revert

I’ve had a bad night! Somehow the database I was working on lost all its data. I was trying to expand data from a summary file, and none of the commands or programmes specifying outline level were achieving anything. The only thing that worked was to remove summaries (which I didn’t really want to do). I was going around in circles getting frozen at the same point each time. Then, suddenly, there was nothing! Maybe I accidentally pressed remove records? but I won’t know because I haven’t been able to get my data back to try again. When I try to use the Revert to previously saved version, the programme just crashes. I’ve tried multiple times, selecting different time versions, but always the same result. (I then tried reimporting the previous Panorama6 file, and another bug arose, which I’ve posted elsewhere!!). Hopefully tomorrow will be a better day…

I’ve just managed to reimport my data using the fix I found in another post, so I’m back to my original problem.
I have grouped and summarised data to display quarterly totals for a financial problem. The procedure I wrote to view the data making up a particular quarter does nothing:

local a
a = Quarter
selectwithin Quarter = a
field Category
outlinelevel "0"
openform "PData"
firstrecord

Well actually, it does select the quarter, so I end up with that single summary record only, but it doesn’t expand the data at all. When I go to the data sheet and try to use the “Sum” menu at the top, I can’t get anything to do anything: expand 1 level/expand all levels/Outline level raw data. Remove summaries DOES work, and I have nothing on screen. I can then select all and start again, but I have all the records, not the particular records (for that quarter) that I wanted…

I think the zero after the outlinelevel statement should not be quoted.

SelectWithin selects within the visible records. If you selected the summary record while the database was collapsed, it’s the only record in that group that’s selected.

If the data records in that group have the same value in the Quarter field that the summary has, you can just do a Select, or you could expand first and then do your SelectWithin.