Hi all,
I'm trying to create a simple temp-table at run-time ; here is the code I use :
CREATE TEMP-TABLE hTable.
hTable:ADD-NEW-FIELD ( "idGroup", "character").
hTable:ADD-NEW-FIELD ( "nomGroupe", "character").
hTable:TEMP-TABLE-PREPARE("Soldes").
Now as I try to add some data in this temp-table with :
hBufTTSoldesGroup = hTable:DEFAULT-BUFFER-HANDLE.
DO TRANSACTION:
BufferGroup:BUFFER-CREATE().
hBufferGroup:BUFFER-FIELD ("idGroup"):BUFFER-VALUE = "AAA".
END.
I get an error message speaking about index at 0... well I finally understand that the name "idGroup" doesn't exists in the temp-table. If I change it by the index 1, than I seems to work.
So I found a small piece of code, to get the field name of my temp-table, and I get all fields named "Soldes" ! (this should be the temp-table name)
DEFINE VARIABLE ii AS INTEGER.
DEFINE VARIABLE hFieldBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hRecordBufferHandle AS HANDLE NO-UNDO.
ASSIGN hRecordBufferHandle = hTable:DEFAULT-BUFFER-HANDLE.
DO TRANSACTION:
DO ii = 1 TO hRecordBufferHandle:NUM-FIELDS:
hFieldBufferHandle = hRecordBufferHandle:BUFFER-FIELD(ii).
MESSAGE "hRecordBufferHandle:NAME " ii " = " hRecordBufferHandle:NAME VIEW-AS ALERT-BOX.
END.
END.
I'm using openedge 11.2 ... anyone have an idea why I can't use my "idGroup" ?
Next, I need to create a probindingsource using this temp-table, and, probably because I have many fields with the same name, creating the binding source crash the application.
Thanks
Hi all,
I'm trying to create a simple temp-table at run-time ; here is the code I use :
CREATE TEMP-TABLE hTable.
hTable:ADD-NEW-FIELD ( "idGroup", "character").
hTable:ADD-NEW-FIELD ( "nomGroupe", "character").
hTable:TEMP-TABLE-PREPARE("Soldes").
Now as I try to add some data in this temp-table with :
hBufTTSoldesGroup = hTable:DEFAULT-BUFFER-HANDLE.
DO TRANSACTION:
BufferGroup:BUFFER-CREATE().
hBufferGroup:BUFFER-FIELD ("idGroup"):BUFFER-VALUE = "AAA".
END.
I get an error message speaking about index at 0... well I finally understand that the name "idGroup" doesn't exists in the temp-table. If I change it by the index 1, than I seems to work.
So I found a small piece of code, to get the field name of my temp-table, and I get all fields named "Soldes" ! (this should be the temp-table name)
DEFINE VARIABLE ii AS INTEGER.
DEFINE VARIABLE hFieldBufferHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE hRecordBufferHandle AS HANDLE NO-UNDO.
ASSIGN hRecordBufferHandle = hTable:DEFAULT-BUFFER-HANDLE.
DO TRANSACTION:
DO ii = 1 TO hRecordBufferHandle:NUM-FIELDS:
hFieldBufferHandle = hRecordBufferHandle:BUFFER-FIELD(ii).
MESSAGE "hRecordBufferHandle:NAME " ii " = " hRecordBufferHandle:NAME VIEW-AS ALERT-BOX.
END.
END.
I'm using openedge 11.2 ... anyone have an idea why I can't use my "idGroup" ?
Next, I need to create a probindingsource using this temp-table, and, probably because I have many fields with the same name, creating the binding source crash the application.
Thanks
Flag this post as spam/abuse.
Could you please post your exact error messages as these will help :)
With a slight tweak your code works which suggests you have mixed up your handles.
def var htable as handle. def var hBufTTSoldesGroup as handle. CREATE TEMP-TABLE hTable. hTable:ADD-NEW-FIELD ( "idGroup", "character"). hTable:ADD-NEW-FIELD ( "nomGroupe", "character"). hTable:TEMP-TABLE-PREPARE("Soldes"). hBufTTSoldesGroup = hTable:DEFAULT-BUFFER-HANDLE. DO TRANSACTION: hBufTTSoldesGroup:BUFFER-CREATE(). hBufTTSoldesGroup:BUFFER-FIELD ("idGroup"):BUFFER-VALUE = "AAA". END.
By the way, you must make sure you delete your dynamic objects on completion of use so that you don't get memory leaks.
Hi,
Just a little change from hBufferGroup to hBufTTSoldesGroup and all worked fine.
DEF VAR hTable AS HANDLE NO-UNDO.
DEF VAR hBufTTSoldesGroup AS HANDLE NO-UNDO.
DEF VAR qh AS HANDLE NO-UNDO.
DEF VAR fld1 AS HANDLE NO-UNDO.
DEF VAR fld2 AS HANDLE NO-UNDO.
CREATE TEMP-TABLE hTable.
hTable:ADD-NEW-FIELD ( "idGroup", "character").
hTable:ADD-NEW-FIELD ( "nomGroupe", "character").
hTable:TEMP-TABLE-PREPARE("Soldes").
hBufTTSoldesGroup = hTable:DEFAULT-BUFFER-HANDLE.
DO TRANSACTION:
hBufTTSoldesGroup:BUFFER-CREATE().
hBufTTSoldesGroup:BUFFER-FIELD("idGroup"):BUFFER-VALUE = "AAA".
hBufTTSoldesGroup:BUFFER-FIELD("nomGroupe"):BUFFER-VALUE = "AAAaaaaaaaaaaaaa".
hBufTTSoldesGroup:BUFFER-CREATE().
hBufTTSoldesGroup:BUFFER-FIELD("idGroup"):BUFFER-VALUE = "bbb".
hBufTTSoldesGroup:BUFFER-FIELD("nomGroupe"):BUFFER-VALUE = "bbbbbbbbbbbbb".
END.
CREATE QUERY qh.
qh:SET-BUFFERS(hBufTTSoldesGroup).
qh:QUERY-PREPARE("FOR EACH Soldes no-lock").
qh:QUERY-OPEN().
fld1 = hBufTTSoldesGroup:BUFFER-FIELD("idGroup").
fld2 = hBufTTSoldesGroup:BUFFER-FIELD("nomGroupe").
REPEAT:
qh:GET-NEXT().
IF qh:QUERY-OFF-END THEN LEAVE.
DISPLAY fld1:BUFFER-VALUE() FORMAT "X(10)".
DISPLAY fld2:BUFFER-VALUE() FORMAT "X(20)".
END.
qh:QUERY-CLOSE().
You're right James, I mixed the handle !! so, ok, I've got the right field name ! Thanks.
Thanks Marco too for this pretty clear example :)
But, I still have my application stopping when trying to create the bindingsource like described here :
documentation.progress.com/.../index.html
rBindS = NEW Progress.Data.BindingSource(hDataSet, hBufTTSoldes, "*", "").
Still looking why...