dc_dbgather()

This forum is for eXpress++ general support.
Message
Author
bobvolz
Posts: 117
Joined: Sun Jan 31, 2010 11:25 am

dc_dbgather()

#1 Post 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

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: dc_dbgather()

#2 Post by Cliff Wiernik »

Bob,

We are also arriving Wednesday afternoon. See you then.

Cliff

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: dc_dbgather()

#3 Post 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 ??
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

bobvolz
Posts: 117
Joined: Sun Jan 31, 2010 11:25 am

Re: dc_dbgather()

#4 Post 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.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: dc_dbgather()

#5 Post by Cliff Wiernik »

We arrive a 12:42 so we are a bit too early.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: dc_dbgather()

#6 Post by bwolfsohn »

Bob,
I left you a msg on your phone.. i'd like to connect at the airport..
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

bobvolz
Posts: 117
Joined: Sun Jan 31, 2010 11:25 am

Re: dc_dbgather()

#7 Post by bobvolz »

No problem. I will look for you there.
BV

bobvolz
Posts: 117
Joined: Sun Jan 31, 2010 11:25 am

Re: dc_dbgather()

#8 Post by bobvolz »

Hi Roger;

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

Bob Volz

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: dc_dbgather()

#9 Post 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.
The eXpress train is coming - and it has more cars.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: dc_dbgather()

#10 Post 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

Post Reply