Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why not deleting?
Message
From
11/10/1999 15:48:51
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00274937
Message ID:
00275124
Views:
19
>>>>>Sorry, I did not mean for you to discard the LOCATE command.
>>>>>select gisum (parent)
>>>>>replace lc_action with "D"
>>>>>dele
>>>>>currec= recno()
>>>>>csessionkey = gisum.sessionkey
>>>>>Select gidetail
>>>>>LOCATE for gidetail.sessionkey = csessionkey
>>>>>if !eof()
>>>>>   lnDelrec= recno()
>>>>>   replace gidetail.lc_action with "D" while gidetail.sessionkey = csessionkey
>>>>>   goto lnDelrec
>>>>>   delete while gidetail.sessionkey = csessionkey
>>>>>endif
>>>>>go currec
>>>>
>>>>
>>>>Hi Mark:
>>>>
>>>>Still not working for me...it's skipping over the records that
>>>>match the sessionkey and not deleting them
>>>
>>>I made an assumption that the child table has the index set to the SessionKey field. This allows for quicker deletion using the WHILE clause instead of FOR. The FOR will scan all records. WHILE will do a Replace, Delete, etc., while that field is equal to the variable. Did you by chance open the child table/view using the NoUpdate clause or in some other way make the table/view read-only?
>>>
>>>Also, if the table is ordered by SessionKey, the LOCATE can be changed to a SEEK. Otherwise, the code above should now work if you do not have a SET FILTER TO LC_ACTION <> "D". Do the child records at least show that field getting changed to "D"?
>>
>>HI:
>>
>>I just don't know what's happening here...
>>i just tried deleting child records first but still only deleted parent.
>>
>>My code is now:
>>
>>Select gisum
>>csessionkey= gisum.sessionkey
>>
>>select gidetail
>>seek(csessionkey)
>>if found()
>> if !eof()
>> lndelrec =recno()
>> replace lc_action with "D"
>> goto lndelrec
>> dele all while getail.sessionkey=csessionkey
>>endif
>>endif
>>
>>I have no filters on the tables, there is primary key on gisum - sessionkey
>>regular index on gidetail - sessionkey,(both tagged sessionkey) it finds the matching sessionkey
>>shows through the debugger that it's replacing, goto lndelrec skips over
>>the records i want to delete. When I check the dbf afterwards, no change to Lc_action(No d"S) and records not deleted.
>>
>>Fred was mentioning earlier that skipping could be caused by a replace statement.
>>When I append blank in Gidetail - i do a replace gisum.sessionkey with
>>gidetail.sessionkey.
>>
>>I'm stumped!!
>
>
>Even when you step through with the debugger, you should see the "D" being replaced in your field, and then the record should get deleted. What is the current state of SET('DELETED), just before you try to replace the "D" in lc_action?

Hi Fred:

It's not replacing my field as I thought through the debugger, also my set deleted is on. It doesn't execute the replace statement?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform