General X++ Development
How do I dynamically access a field on a table buffer in X++?
How do I dynamically access a field on a table buffer in X++?
1 answer
Write an answerUse a Common buffer and access the field by FieldId.
Common common = custTable;
anytype value = common.(fieldNum(CustTable, AccountNum));This is useful for generic code.
If you already know the table and field at compile time, normal strongly typed access is still cleaner:
value = custTable.AccountNum;Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer