Can't assign values in records displayed by outlinelevel statement

From d/b alpha, I open d/b beta which has 690 records. The procedure in alpha runs this code to summarise the records in beta and assign a value to the Kounter field in each summary record:

field Kounter fill ""
field SourcePIC groupup
field TransferDate groupup by day
field RFID count
field SourcePIC propagate
field VendorName propagate
field RFID unpropagate
select RFID > ""
removeunselected
outlinelevel 1

field Kounter 
    let I = 1
    loop
        Kounter = I
        I = I + 1
        downrecord
    until info("stopped")

When it comes to assigning values in the Kounter field, the display reverts to all records without any summaries and assigns 690 values.

If I put the identical code in a procedure in the beta d/b, it does what I want, which is to assign values only to the summary records. I’m using a loop to assign the values because I tried using

field Kounter sequence 1,1

but that just put the value 1 into every summary record.

Why is this happening and how do I get around it?

The sequence command is supposed to restart the count for each group, so that’s the correct behavior. Rather than a loop, you could use

field Kounter
formulafill seq()

I can’t duplicate the problem you are having with the loop. I just tested the ending of your procedure . I added a Kounter field to a database that had been grouped, and ran this from another database.

OpenFile "Test Fields"
OutlineLevel 1

field Kounter 
    let I = 1
    loop
        Kounter = I
        I = I + 1
        downrecord
    until info("stopped")

It only put numbers in the summary records.

Yes - I missed that in the documentation.

The seq( function works.

The original problem lay in the removeunselected statement - that returned the data sheet to a full listing.

Thanks Dave.