1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

ADD-NEW-FIELD on a dynamic temp-table

Discussão em 'PSDN - Forum' iniciado por Marc, Junho 9, 2015.

  1. Marc

    Marc Guest

    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

    Continue reading...

Compartilhe esta Página