Notifications
Announcements
No record found.
hi all,
please let me know the xRecord class and common class . i saw the classes are used in stnd. code.
please let me know what is the different between both classes? and when to use?
i refereed this,but not clear
https://docs.microsoft.com/en-us/previous-versions/dynamics/ax-2012/reference/aa625830(v=ax.60)?redirectedfrom=MSDN
please elaborate me
Seems you already found the documentation, and it says:
"The xRecord class can be seen as the base class for the Common table. The Common table can be seen as the base table for all tables."
Common is used when you want to have generic handling for table buffers, regardless of the buffer type. Perhaps you have a class and a constructor that takes a Common object as a parameter. Depending on the tableId of common (=which table buffer is actually passed) you can instantiate and return a different child class.
So, you found the documentation, and you have seen how they are used in the standard code. Do you have any specific questions which were not answered by studying these things?
Common isn't a class - it's a table. As the documentation says, "The Common table is the base class for all tables. It does not contain any data. It is primarily used in X++ code to refer to any table in a polymorphic way."
I wonder where you saw xRecord class used in code. As far as I know, it's a kernel implementation of table methods and it's not normally used directly. According to cross-references in F&O, there are just a few places where xRecord is referenced and it's always just to get method names.
I saw common table not xrecord
All right, that makes sense (you originally claimed that you "saw the classes are used in stnd. code").
Nikolas,
Please give me an example of common table. So, that I can understand properly
I already gave you an example in my first reply.
Since you said that you found standard code where Common is used, perhaps you can go where you saw it, and try to figure out how it works. And if you need our help in that, just let us know what code it was.
Thanks!
Nikoloas,
static void DataDic_Common(Args _args)
{
Common common;
CustTable custTable;
;
common = custTable;
if (common.tableId == tablenum(custTable))
while select common
info(common.(fieldnum(custTable, name)));
}
Let me know why common is used? We can loop directly CustTable rite?
Could you please use Rich text formatting - Insert - Code when you share your code?
Other than that, I don't have anything to add, except to read my previous messages.
That's surely not standard code. It's seems to be a job and the code doesn't do anything useful. We can't explain to you code that makes no sense.
Some time we don't know the table I'd or field I'd if any tables. So, with help of common , we can pass the parameters of table I'd and get the value of ( recid ) of actual table. Then we can manipulate that table as per requirement.
Is it rite?
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 449 Super User 2025 Season 2
Martin Dráb 422 Most Valuable Professional
BillurSamdancioglu 239 Most Valuable Professional