Page 1 of 1

New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 7:00 am
by rdonnay
There are 9 new methods in a DC_DbRecord() object

::RecNo()
::Deleted()
::Alias()
::Scatter()
::Gather()
::IsEmpty()
::Trim()
::asArray()
::clear()

Copy _DCFUNCT.PRG to your ..\source\dclipx folder and run BUILD19_SL1.BAT or BUILD20.BAT.

Example:

Code: Select all

USE customer
oRecord := CUSTOMER->(DC_DbRecord():new())

oRecord:scatter()

oRecord:bill_name := 'New Name'

oRecord:gather()

oRecord:clear()

? oRecord:isEmpty()
TRUE

oRecord:Trim()

aData := oRecord:asArray()

? o:RecNo()
123

? o:Deleted()
FALSE

? o:Alias()
CUSTOMER

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 10:32 am
by Wolfgang Ciriack
Hi Roger,
very nice. What is the best way to get an empty record object ?

Code: Select all

oRecord := CUSTOMER->(DC_DbRecord():new())
oRecord:scatter()
oRecord:clear()
oRecord:RecNo:=0
Or is there a better way ? Nice would be

Code: Select all

oRecord:scatter(.T.) 
for an empty record object.

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 10:41 am
by rdonnay
What is the best way to get an empty record object ?
oRecord := DC_DbRecord():new():clear()

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 10:47 am
by Wolfgang Ciriack
Perfect, thank you.
Do you plan to add a ::Save method (if :RecNo=0 append otherwise replace) ?

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 1:24 pm
by rdonnay
Do you plan to add a ::Save method (if :RecNo=0 append otherwise replace) ?
:Gather() will take care of that.
I need to update it to automatically add a new record if ::recno() is empty.
I will give a fix for that.

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 1:44 pm
by bobvolz
Hi Roger;
Thanks for the great time in Boise. I got a lot accomplished. The banquet was a lot of fun as well.

I use the following code to create a blank record object. Is this OK?

oRecord:=BDCOPER->(DC_DBRECORD():NEW())
BDCOPER->(DB_INIT(oRecord))

Strangely enough I have this craving for asparagus!

Bob Volz

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 2:03 pm
by rdonnay
I use the following code to create a blank record object. Is this OK?

oRecord:=BDCOPER->(DC_DBRECORD():NEW())
BDCOPER->(DB_INIT(oRecord))
Everything will still work as before.
These new methods only make it easier to use.

DB_INIT() is not an eXpress++ function.
I thinks it's from Bobby's library.

Re: New Methods in DC_DbRecord()

Posted: Fri May 15, 2015 2:31 pm
by bobvolz
Your probably right, I thought it was xBase Tools. I'll try the clear method next time.

BV