Record objects

This forum is for eXpress++ general support.
Post Reply
Message
Author
bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Record objects

#1 Post by bwolfsohn »

Roger,

I'm doing some work with record object...

after doing
dc_dbrecord():new()
dbgoto(0)
dc_dbscatter()

there are some fields that have a valtype "U"

shouldn't all fields have the proper datatype from the database ?

I'm using an older version of dc_dbscatter() since we had some trouble with the dc_db* functions back in september.

Code: Select all

*********************
function dc_dbscatter( oRecord )
*********************
LOCAL i, aStruct, xData

aStruct := dbStruct()

FOR i := 1 TO Len(aStruct)
  xData := FieldGet(i)
  IF IsMemberVar(oRecord,aStruct[i,1])
    oRecord:&(aStruct[i,1]) := xData
	else
		//dcbdebug i,aStruct[i,1]
	endif
NEXT

RETURN oRecord
but, even the 261 version

Code: Select all

FUNCTION DC_DbScatter( oRecord, cRecNoFieldName, cDeletedFieldName )

LOCAL i, aStruct, xData, cFieldName

DEFAULT cRecNoFieldName := 'RECORD_NUMBER', ;
        cDeletedFieldName := 'RECORD_DELETED'

aStruct := dbStruct()

FOR i := 1 TO Len(aStruct)
  cFieldName := aStruct[i,1]
  xData := FieldGet(i)
  IF IsMemberVar(oRecord,cFieldName)
    xData := FieldGet(i)
    oRecord:&(aStruct[i,1]) := xData
  ENDIF
NEXT

IF IsMemberVar(oRecord,'RECORD_NUMBER')
  oRecord:record_number := RecNo()
ENDIF

IF IsMemberVar(oRecord,'RECORD_DELETED')
  oRecord:record_deleted := Deleted()
ENDIF

RETURN oRecord
seems like it's leaving "U"'s for some fields..

I'm enclosing the file that this applies to.. i did not enclose the index

as usual, i'm sure i'm missing something..
Attachments
maifile.zip
(2.07 KiB) Downloaded 601 times
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

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Record objects

#2 Post by Tom »

DC_DbRecordClassName() is a get-set-function that creates a class name with the first call of DC_DbScatter(). If the database changes, you may call this function with another name, like
DC_DbRecordClassName({||'DB_MyNextTable'}) or the alias or table name. This will prevent DC_DbScatter() from using the same structure as with the table before.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

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

Re: Record objects

#3 Post by rdonnay »

I'm using an older version of dc_dbscatter() since we had some trouble with the dc_db* functions back in september.
I want to work with you on this.
Apparently, the new methods added to the class are causing problems for you.
Is this because you are transferring record objects via Xb2.Net?
There is probably an issue with Var2Bin() and Bin2Var() due to these methods.
You need to have the same version of eXpress++ and Xbase++ on both the send and receive sides.
DC_DbRecordClassName()
Tom may be on the right track here but you haven't given enough info.
I need source code and your database.
The eXpress train is coming - and it has more cars.

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

Re: Record objects

#4 Post by bwolfsohn »

the original problem had to do w/ xb2net.

this problem is strictly desktop, has nothing to do with bin2var/var2bin.

It's just a simple record object, but i was presuming that all fields after dc_dbscatter() would be properly defined

i gave you the database. it's in the zip...

when i open that, and then use:

dc_dbrecord():new()
dbgoto(0)
dc_dbscatter()

I end up with "U" valtypes.
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

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

Re: Record objects

#5 Post by rdonnay »

I don't see a problem with the record object.

Al the fields have a proper value. Only __NoIvar is a U and all methods.
The eXpress train is coming - and it has more cars.

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

Re: Record objects

#6 Post by bwolfsohn »

ok... let's go over it on teamviewer in a few minutes..
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

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

Re: Record objects

#7 Post by bwolfsohn »

ooooooook... problems solved... stupid programmer tricks 101...

lessons learned:

1. ALWAYS alias your dc_db* routines.

2. a second set of eyes will find a problem in short order that you've been searching for for hours..
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

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

Re: Record objects

#8 Post by Cliff Wiernik »

Those 2nd set of eyes should always be available for low cost purchases. I have experienced the same many times.

Sometimes some dreaming inbetween also helps.

Cliff

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

Re: Record objects

#9 Post by bwolfsohn »

cliff, take a look at the scrolling dialog roger did... it's a big improvement...

still a ways to go though...
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

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

Re: Record objects

#10 Post by Cliff Wiernik »

Was planning. Just been tied up.

Post Reply