Dynamics

Hi all,

I'm using:

REPEAT WHILE v-hdl_que:GET-NEXT(NO-LOCK):
p-hdl_tmp_tbl:BUFFER-CREATE.
p-hdl_tmp_tbl:BUFFER-COPY(v-hdl_buf, v-except).
END.

to fill a temporary table. Variable v-except is a comma seperated string with fields I don't want to assign.
Is there another way to fill the temporary table without using the buffer-copy statement.
In some cases I only want to assign 1 or 2 fields in a 50 fields table. In this case I have to create a long exception-list.

Any help appreciated.
 

jongpau

Member
HI Henri,

I am not a Dynamics user myself (and not sure if I ever will be, but that's besides the point). How about,for instance, creating a comma separated list of fields you DO want to assign and parse that list and assigning each of the fields separately?

Code:
FieldsToAssign = "Field1,Field2":U.
REPEAT WHILE v-hdl_que:GET-NEXT(NO-LOCK): 
  p-hdl_tmp_tbl:BUFFER-CREATE. 
  DO FieldCounter = 1 TO NUM-ENTRIES(FieldsToAssign):
    ASSIGN FieldHandle = p-hdl_tmp_tbl:BUFFER-FIELD(ENTRY(FieldCounter,FieldsToAssign))
           FieldToCopy = v-hdl_buf:BUFFER-FIELD(ENTRY(FieldCounter,FieldsToAssign)).
    IF VALID-HANDLE(FieldHandle) AND
       VALID-HANDLE(FieldToCopy)
    THEN FieldHandle:BUFFER-VALUE = FieldToCopy:BUFFER-VALUE.
  END. /* do fieldcounter */
END. /* repeat */
All of the above without handling extents, data-type mapping and trapping all sorts of nasty errors like non existent fields etc.... that's up to your imagination :)

Interesting point is finding out when the performance of a construction like the one above is lower than the performance of a buffer-copy (with a larger except list).... and what amount of performance degradation is still acceptable.


Anyway, it's just an idea...

HTH.
 
Top