Hi,
Finally reopened my blog for first post.
May all aware of buf2buf() method in global class, it basically works for same table. If you duplicate the table and load the data for same it will through error, reason is id will differ between original and duplicated table though it has same structure.
Here have came up with new method which basically transfer data from source table to another table, here field mapping happens through fieldname not fieldid.
static void buf2BufName(
Common _from,
Common _to
)
{
DictTable dictTable = new DictTable(_from.TableId);
DictTable dictTable1 = new DictTable(_to.TableId);
fieldId fieldId = dictTable.fieldNext(0);
fieldName fieldName = dictTable.fieldName(fieldId);
while (fieldId && ! isSysId(fieldId))
{
//_to.(fieldId) = _from.(fieldId);
_to.(dictTable1.fieldName2Id(fieldName)) = _from.(dictTable.fieldName2Id(fieldName));
fieldId = dictTable.fieldNext(fieldId);
fieldName = dictTable.fieldName(fieldId);
}
}
Add this method in global class and access any where in the application.
Thanks,
K. Arunsubramaniam
Finally reopened my blog for first post.
May all aware of buf2buf() method in global class, it basically works for same table. If you duplicate the table and load the data for same it will through error, reason is id will differ between original and duplicated table though it has same structure.
Here have came up with new method which basically transfer data from source table to another table, here field mapping happens through fieldname not fieldid.
static void buf2BufName(
Common _from,
Common _to
)
{
DictTable dictTable = new DictTable(_from.TableId);
DictTable dictTable1 = new DictTable(_to.TableId);
fieldId fieldId = dictTable.fieldNext(0);
fieldName fieldName = dictTable.fieldName(fieldId);
while (fieldId && ! isSysId(fieldId))
{
//_to.(fieldId) = _from.(fieldId);
_to.(dictTable1.fieldName2Id(fieldName)) = _from.(dictTable.fieldName2Id(fieldName));
fieldId = dictTable.fieldNext(fieldId);
fieldName = dictTable.fieldName(fieldId);
}
}
Add this method in global class and access any where in the application.
Thanks,
K. Arunsubramaniam
No comments:
Post a Comment