We have a table with addresses, and in the early days it was added into the db as an extent field with 3 extents. Then one day there was another programmer that added an extra field Address4 instead of adding an extra extent.
An now I am making a rest endpoint for this table and wanted to add a temp-table with address extent 4. So good, so far. I am able to do a buffer-copy between the buffers, but getting nothing in the address field. I make a test, and finds out that both adresse fields need to have the same amount of extents. So basically I need to travers the array and... you know the drill.
Is this the case? I just wondering, because I am not geting any errors, as I do if I test with variables :
def var a as char extent 3 no-undo.
def var b as char extent 4 no-undo.
a = b.
I was hoping it would fill as much as it could.
//Geir Otto
I don't even manage to BUFFER-COPY if the extents are different.
Try this:
DEFINE TEMP-TABLE ttOne NO-UNDO
FIELD cName AS CHARACTER EXTENT 3.
DEFINE TEMP-TABLE ttTwo NO-UNDO
FIELD cName AS CHARACTER EXTENT 4.
CREATE ttOne.
ASSIGN ttOne.cName[1] = 'a' ttOne.cName[2] = 'b' ttOne.cName[3] = 'c'.
buffer ttTwo:buffer-create().
buffer ttTwo:buffer-copy(buffer ttOne:handle).
MESSAGE ttTwo.cName[1] ttTwo.cName[2] ttTwo.cName[3]
VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
Try this:
DEFINE TEMP-TABLE ttOne NO-UNDO
FIELD cName AS CHARACTER EXTENT 3.
DEFINE TEMP-TABLE ttTwo NO-UNDO
FIELD cName AS CHARACTER EXTENT 4.
CREATE ttOne.
ASSIGN ttOne.cName[1] = 'a' ttOne.cName[2] = 'b' ttOne.cName[3] = 'c'.
buffer ttTwo:buffer-create().
ASSIGN ttTwo.cName[1] = ttOne.cName[1] ttTwo.cName[2] = ttOne.cName[2] ttTwo.cName[3] = ttOne.cName[3] ttTwo.cName[4] = ttOne.cName[3].
DISPLAY ttTwo.cName[1] ttTwo.cName[2] ttTwo.cName[3] ttTwo.cName[4].
When a native buffer-copy does not help, you can serialize and deserialize it as xml - abldojo.services.progress.com:443/
define temp-table ttone
field ii as int extent 3
.
define temp-table tttwo
field ii as int extent 4
.
def var lcc as longchar.
create ttone. assign ttone.ii[1] = 1 ttone.ii[2] = 2 ttone.ii[3] = 3.
buffer ttone:serialize-name = "tttwo".
buffer ttone:write-xml( "longchar", lcc ).
buffer tttwo:read-xml( "longchar", lcc, ?, ?, ? ).
find tttwo.
message
1 tttwo.ii[1] skip
2 tttwo.ii[2] skip
3 tttwo.ii[3]
.
NOTE: just for fun - beware that read-xml and write-xml operate on the temp-table and not the record.
Thanks
19. feb. 2020 kl. 14:43 skrev Stefan Drissen <bounce-14941@community.progress.com>:
<ProgressEmailLogo-png_2D00_150x42x2-png>Update from Progress Community
Stefan Drissen When a native buffer-copy does not help, you can serialize and deserialize it as xml - abldojo.services.progress.com:443/
define temp-table ttone
field ii as int extent 3
.
define temp-table tttwo
field ii as int extent 4
.
def var lcc as longchar.
create ttone. assign ttone.ii[1] = 1 ttone.ii[2] = 2 ttone.ii[3] = 3.
buffer ttone:serialize-name = "tttwo".
buffer ttone:write-xml( "longchar", lcc ).
buffer tttwo:read-xml( "longchar", lcc, ?, ?, ? ).
find tttwo.
message
1 tttwo.ii[1] skip
2 tttwo.ii[2] skip
3 tttwo.ii[3]
.
NOTE: just for fun - beware that read-xml and write-xml operate on the temp-table and not the record.
You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here.
Flag this post as spam/abuse.