Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append new record
Message
From
27/06/2005 02:07:03
 
 
To
27/06/2005 01:33:10
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01026609
Message ID:
01026611
Views:
15
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform