Subject Re: Append problem xdml
From Bruce Beacham <bbeacham@no_plm_lowman.co.uk>
Date Sun, 8 Nov 2020 22:15:53 +0000
Newsgroups dbase.getting-started

And...

On 08/11/2020 22:13, Bruce Beacham wrote:
> Seems to be some odd coding here.
>
> On 08/11/2020 10:23, Charlie wrote:
>
>> use taldata order lname
>>     do while not eof()
>>        partno = part_no
>>         set filter to part_no = partno
>>         count to cnt
>>         if cnt > 1
>
> So you are removing all records with this partno except for the last one.
>
>>            cntr = cnt

Here you should insert:
goto top

>>             do while cntr > 1
>>                delete
>>                cntr = cntr - 1
>>             enddo
>
> The table is still pointing to the deleted record.   so you are
> recording this information on the deleted record - deliberately?
>
>>             replace qty with cnt
>>            set filter to
>>         endif
>>         skip
>
> You are now pointing to the next record after the deleted record.   At
> some point you may encounter the last record carrying the partno you
> have just reduced to one record - but its qty field could contain any
> value.
>
> But you may not encounter it:  that depends on where it lies relative to
> the rows for the partno you are now going to collapse.
>
>
>>     enddo
>
> Bruce Beacham
>
>
>> And it does add the blank correctly but it also changes somehow the
>> size of taldata.dbf and fails when you try to run talfinis.prg.  I
>> think it has something to do with an indexing problem.  What happens
>> is instead of replacing all fields, only the last record in taldata is
>> changed.  So if you add a total of 60 records in master.dbf, the last
>> record of corresponding taldata.dbf shows a quantity of 60.  I have
>> tried to reindex taldata.dbf but i don't think that helped.
>>
>> i'm thinking possibly I can fix this in talfinis.prg but with the set
>> relation, i'm not sure what to do.
>>
>> If worse comes to worse i can just tell the operator of the other
>> computer not to introduce an item not already in master.dbf.
>>
>> Sorry this is so long and probably confusing.  Just one of those
>> stupid problems that I hope there is an easy fix for.
>>
>>
>>