hi,
thank you.
i'll try.
>>hi,
>>thank you very much,it works
>>another thing
>>i need to insert data at this new records as under
>
>Totals in the records themselves? I assume this is for a report; in this case, I suggest you do the following. In the report, use data grouping and sum the minutes (hours * 60 + minutes), or the seconds (hours * 3600 + minutes * 60 + seconds) in a report variable. For showing the total, use a UDF to format the data minutes as hh:mm:ss.
>
>>
>>
>>
>>
>>USE curbilldata
>>
>>DO WHILE NOT EOF()
>> m.divi = curbilldata.divi
>> DO WHILE m.divi = curbilldata.divi AND NOT EOF()
>> SKIP
>> ENDDO
>> IF NOT EOF()
>>
>>
>> INSERT BEFORE BLANK
>>SUM VAL(LEFT(tot_m,8))*3600 + ;
>> VAL(SUBSTR(tot_m,6,3))*30 + ;
>> VAL(RIGHT(tot_m,6)) TO lnSec for m.divi = curbilldata.divi
>>
>>m.dae= PADL(INT(lnSec/3600), 6, "0") + ":" + ;
>> PADL(INT((lnSec%3600)/60),2, "0")
>> replace m1_m WITH m.dae
>> SKIP
>> ENDIF
>>ENDDO
>>
>>
>>thanks.
>>>APPEND BLANK puts a new blank record at the end of the table and therefore does not put a blank record where you seem to be expecting it.
>>>
>>>There is an old INSERT command which is sill supported in VFP 6 for backwards compatability. I don't know if it has been kept in any of the later versions. So the code you want is
>>>
>>>
>>>USE table1
>>>DO WHILE NOT EOF()
>>> m.divi = table1.divi
>>> DO WHILE m.divi = table1.divi AND NOT EOF()
>>> SKIP
>>> ENDDO
>>> IF NOT EOF()
>>> INSERT BEFORE BLANK
>>> SKIP
>>> ENDIF
>>>ENDDO
>>>
>>>
>>>While the above code does (I think) what you asked for, I suggest you
seriously rethink whatever it is you are trying to do that wants you to physically place a blank record before each change of divi. Putting any sort of index on divi will cause these blank records to move elsewhere in the ordered table. In addition, each time you INSERT BLANK BEFORE you are making a full copy of the table to insert the blank record. On large tables, this is hideously inefficient. While I don't know exactly what you need to get done, I'm sure there must be a better way than this to do it.
>>>
>>>
>>>
>>>>hi all,
>>>>
>>>>i need to append new record if the item name is different
>>>>ex..
>>>>
>>>>use table1
>>>>m.divi=divi
>>>>scan
>>>>if m.divi<>divi
>>>>append blank
>>>>endif
>>>>endscan
>>>>*****************************
>>>>ex....
>>>>
>>>>field name is divi
>>>> a
>>>> a
>>>> a
>>>>---------------------->new record
>>>> bb
>>>> bb
>>>>---------------------> new record
>>>> sss
>>>> sss
>>>> .
>>>> .
>>>>
>>>>thanks.