rahul.kolhe22
11th December 2008, 10:02
Hi,

I am trying to use the array of the record buffer to store some bunch of records. I am able to store the values of the fields in the array of record buffer, but I am not able to get the values back from it.

Code used by me:
select ttmmm999.*
from ttmmm999
where ttmmm999._index1 = {:value1, :value2}
selectdo
db.row.length(tttmmm999,buff.size)
cntr = cntr + 1
if cntr > total.size then
total.size = total.size + 20
alloc.mem(rec.buff, buff.size, total.size)
endif
tbl.ptr = db.bind("tttmmm999", rec.buff(1,cntr))
ret = db.columns.to.record(tbl.ptr)
endselect

while cntr > 0
db.record.to.columns(tbl.ptr)
cntr = cntr - 1
endwhile
free.mem(rec.buff)

I refered the following link:
http://www.baanboard.com/baanboard/showthread.php?p=59661#poststop

But I am unable to get the value form the record buffer to the table field.

Thanks in advance
--Rahul

SergioRuiz
11th December 2008, 11:13
Hello, this works for me


string tmp.buff(1) based
string array.buff(1,1) based
long table.id, cont, aux.len

db.row.length(ttccom020, aux.len)

if aux.len <> 0 then
alloc.mem(tmp.buff, aux.len)
alloc.mem(array.buff, aux.len, 10)
endif

table.id = db.bind("ttccom020",tmp.buff)

if table.id <> 0 then

cont = 0

select tccom020.*
from tccom020
as set with 10 rows
selectdo
cont = cont + 1
db.columns.to.record(table.id)
array.buff(1,cont) = tmp.buff
endselect

for cont = 1 to 10
tmp.buff = array.buff(1,cont)
db.record.to.columns(table.id)
endfor

db.unbind(table.id)
endif

free.mem(tmp.buff)
free.mem(array.buff)

rahul.kolhe22
11th December 2008, 11:44
Hi,
Thanks a lot for your reply. It is working even for me.

--Rahul