Page 1 of 2

dc_dbgather()

Posted: Mon Oct 12, 2015 4:38 pm
by bobvolz
Hi Roger;

I know you added a codeblock parameter to dc_dbgather() so we could reuse deleted records. If for example I used DC_ADDREC(3,.t.,2)
AS THAT code block would the system attempt to find and ultimately point to a reusable record and then update it.?

Lets assume I have a newly created record object oRecord for file CustMast.dbf. I want to use this record object to ADD a new customer record to CustMast but I want to first search to see if I have a deleted record to reuse.

Would this work?

CUSTMAST->(DC_DBGATHER(oRecord,.f.,.t.{||DC_ADDREC(3,.T.,2)}

I'm assuming DC_ADDREC will be executed first and return a pointer to the record number to be updated by DC_DBGATHER()

looking forward to Arizona. See you on Wednesday night.

Bob Volz

Re: dc_dbgather()

Posted: Mon Oct 12, 2015 6:48 pm
by Cliff Wiernik
Bob,

We are also arriving Wednesday afternoon. See you then.

Cliff

Re: dc_dbgather()

Posted: Mon Oct 12, 2015 8:08 pm
by bwolfsohn
I'm arriving wed 3:02 US air from Charlotte. Not sure of the flight number yet..
anybody want to share a ride ??

Re: dc_dbgather()

Posted: Tue Oct 13, 2015 5:15 am
by bobvolz
I have a guy picking me up. I get in Wednesday at 3:54PM American Airlines flight 654 from JFK.
Let me know if you need a lift, I will tell him to bring a bigger car if necessary.
My cell is 203 733 7420.

Re: dc_dbgather()

Posted: Tue Oct 13, 2015 8:53 am
by Cliff Wiernik
We arrive a 12:42 so we are a bit too early.

Re: dc_dbgather()

Posted: Tue Oct 13, 2015 1:32 pm
by bwolfsohn
Bob,
I left you a msg on your phone.. i'd like to connect at the airport..

Re: dc_dbgather()

Posted: Tue Oct 13, 2015 4:41 pm
by bobvolz
No problem. I will look for you there.
BV

Re: dc_dbgather()

Posted: Fri Oct 30, 2015 11:20 am
by bobvolz
Hi Roger;

Still no answer on my dc_dbgather question?. Any help would be appreciated.

Bob Volz

Re: dc_dbgather()

Posted: Fri Oct 30, 2015 2:02 pm
by rdonnay
Sorry, I forgot about this.

Here's how you would do it.

Code: Select all

bLock := {||MyLockRoutine()}

DC_DbGather( oRecord, , , bLock )


FUNCTION MyLockRoutine()

LOCATE FOR Deleted()

IF Eof() 
  RETURN DC_AddRec()
ELSE
  IF DC_RecLock()
    dbRecall()
    RETURN .t.
ENDIF
RETURN .f.

Re: dc_dbgather()

Posted: Fri Oct 30, 2015 4:51 pm
by Cliff Wiernik
We use record recycling but don't currently use dc_dbgather(). We add a index tag that has a for clause limiting it to only deleted records. We would use this as opposed to the locate command. You may want to adapt Roger's suggestion to use this approach if you have very large files.

Cliff