Edit: Peter Chan beat me to it! The only advantage to using my function is an extra semi colon :)
Neither of our methods check to see if the field type is the same...
///Copy two different table buffers but with the same field names.
///May be better to use a Map...
static void bufFields2BufFields(
Common _from,
Common _to
)
{
DictTable dictTableFr = new DictTable(_from.TableId);
FieldId fieldIdFr;
DictTable dictTableTo = new DictTable(_to.TableId);
FieldId fieldIdTo;
FieldName fieldName;
;
fieldIdFr = dictTableFr.fieldNext(0);
fieldName = dictTableFr.fieldName(fieldIdFr);
fieldIdTo = dictTableTo.fieldName2Id(fieldName);
while (fieldIdFr && ! isSysId(fieldIdFr))
{
if (fieldIdTo)
{
_to.(fieldIdTo) = _from.(fieldIdFr);
}
fieldIdFr = dictTableFr.fieldNext(fieldIdFr);
fieldName = dictTableFr.fieldName(fieldIdFr);
fieldIdTo = dictTableTo.fieldName2Id(fieldName);
}
}
No hay comentarios:
Publicar un comentario