Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a Insert Blank at Begining of File
Message
From
14/09/2013 07:52:34
 
 
To
14/09/2013 05:12:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01583256
Message ID:
01583264
Views:
43
lcCursor = 'yourcursor'
alter table (lcCursor) add column lineno I  
select (lcCursor)
replace all lineno with recno() * 10
index on lineno tag lineno
Go top
Scan
   IF STREXTRACT(PS,'(',')')='Usage Charges' AND LEFT(PS,1)='F'
      NEWPS='N '+ALLTRIM(STR(posC-2))+' '+ALLTRIM(STR(posR+7))+' '+ALLTRIM(STR(m.BoxEndcolumn-posC))+' '+'-8 i'
      lnCurrentLine = lineno - 1
      insert into (lcCursor) (lineno, ps) values (lnCurrentLine , NEWPS )
   ELSE
   ENDIF
ENDSCAN   
>Sorry, I didn't got/understood what you said. Please Explain in detail.
>I need to insert a Blank record if my Data is matched during scan & Endscan. The code Which I have shown below does not work if the Matching record is found on record number 1 itself, as Skip-1 does not work here.
>
>Is there any other way, please Guide in detail
>
>
>
>
>>That's not a good idea, for many reasons. Instead you add a numeric column which keeps track of the line number.
>>
>>>I am Using the following code to Insert a Record. However, if the original record is at the Begnining of File i.e if RECNO()=1, I am not able to insert a Blank record before my original record.
>>>
>>>Thus if my STREXTRACT(PS,'(',')')='Usage Charges' AND LEFT(PS,1)='F' is found at the begin of File I need to insert one Blank record before it.
>>>
>>>
>>>
>>>Go top
>>>Scan
>>>IF STREXTRACT(PS,'(',')')='Usage Charges' AND LEFT(PS,1)='F'
>>>NEWPS='N '+ALLTRIM(STR(posC-2))+' '+ALLTRIM(STR(posR+7))+' '+ALLTRIM(STR(m.BoxEndcolumn-posC))+' '+'-8 i'
>>>Skip-1 && Pointer Skips one record above 
>>>INSERT BLANK
>>>Replace PS With NEWPS
>>>Skip Pointer comes Back to Orignal Position
>>>ELSE
>>>ENDIF
>>>ENDSCAN				
>>>
>>>
>>>
>>>Kindly Guide
>>F
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform