Hi all.
I need some help.
I will try to explain my problem. I am building up a dynamic temp-table and populating it from a query before i export this temp-table as xml over to my .NET application. Building the temp-table is ok, but upon filling it with data i have come across a problem. On a couple of fields i have to check in another table to get the field-name i have used. if i write hb::"nameOfField" there is no problem, but if i lookup this field-name in a table i get an error. This do not work : bh: "tt.column".
I have attached a samle code which displays my problem.
Anyone with some tips. I have tried:
if avail bb then
bb::value(bb.field-name) and
if avail bb then
bb::string(bb.field-name) with no luck
I need some help.
I will try to explain my problem. I am building up a dynamic temp-table and populating it from a query before i export this temp-table as xml over to my .NET application. Building the temp-table is ok, but upon filling it with data i have come across a problem. On a couple of fields i have to check in another table to get the field-name i have used. if i write hb::"nameOfField" there is no problem, but if i lookup this field-name in a table i get an error. This do not work : bh: "tt.column".
I have attached a samle code which displays my problem.
Code:
def temp-table bb no-undo
field field-name as char.
create bb.
assign bb.field-name = "NewFieldName".
def var cFields as char init "col1,col2" no-undo.
def var cFieldsDataType as char init "character,character" no-undo.
def var i as int no-undo.
DEFINE VARIABLE htt AS HANDLE NO-UNDO.
DEFINE VARIABLE hb AS HANDLE NO-UNDO.
/*create temp-table dynamically*/
CREATE TEMP-TABLE htt.
do i = 1 to num-entries(cFields,','):
htt:ADD-NEW-FIELD(entry(i,cFields,','), entry(i,cFieldsDataType,',')).
end.
find first bb no-lock no-error.
if avail bb then
htt:ADD-NEW-FIELD(bb.field-name, 'character').
htt:temp-table-prepare("tt":U).
hb = htt:DEFAULT-BUFFER-HANDLE.
hb:BUFFER-CREATE().
if lookup("col1",cFields) > 0 then
hb::col1 = "myfirstfield".
if lookup("col2",cFields) > 0 then
hb::col2 = "Secondfield".
/*Everyting ok until here*/
find first bb no-lock no-error.
/*The following line works ok*/
if avail bb then
hb::NewFieldName = "yoohoo".
/*I don't know the name and therefor i have to use the value from bb*/
/*this don't work. This is my problem*/
if avail bb then
hb::bb.field-name = "yoohoo".
def var a as logical no-undo.
def var c as longchar no-undo view-as editor large inner-chars 200 inner-lines 50.
a = htt:default-buffer-handle:write-xml("longchar",c,true,?,?,true,false).
display c with width 280.
Anyone with some tips. I have tried:
if avail bb then
bb::value(bb.field-name) and
if avail bb then
bb::string(bb.field-name) with no luck