Archive for Mart 25th, 2010

Copying a record

Copying a record
I’ve experienced that one of the tasks often used when manipulating data is record copying.
For various reasons, an existing record needs to be modified and saved as a new one. The
most obvious example could be when a user requires a function that allows him or her to
quickly duplicate records on any of the existing forms.
There are several ways of copying one record into another in X++. In this recipe, we will explain
the usage of table data() method, global buf2buf() function, and their differences. As an
example, we will copy one of the existing customer records into a new one. Normally, copying
a customer involves more data around the customer like customer contacts, bank accounts,
printing settings, and similar, but for demonstration purposes, we will assume that our goal is
only to copy the customer record itself without worrying about related data.
How to do it…

Read more

Using a normal table as temporary table

Standard Dynamics AX contains numerous temporary tables, which are used by the
application and could be used in custom modifications too. Although new temporary tables
could also be easily created using AOT, sometimes it is not effective. One of the cases could
be when the temporary table is very similar or exactly the same as an existing “real” one. The
goal of this recipe is to demonstrate an approach to how standard non-temporary tables could
be used as temporary.

Read more