Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table = Table vs Table.Data(Table)

What is the difference between the two statements below?

newTable = orginalTable

or

newTable.data(originalTable)

I suspect there is a performance benefit to the .data() method as it is more commonly used in standard AX.

like image 399
AnthonyBlake Avatar asked Jul 19 '12 09:07

AnthonyBlake


People also ask

What is a DataTable?

A data table is a range of cells in which you can change values in some of the cells and come up with different answers to a problem. A good example of a data table employs the PMT function with different loan amounts and interest rates to calculate the affordable amount on a home mortgage loan.

What is a DataTable used for?

Data tables are used in Excel to display a range of outputs given a range of different inputs. They are commonly used in financial modeling and analysis to assess a range of different possibilities for a company, given uncertainty about what will happen in the future.

What is excel DataTable?

What is Data Table in Excel? A Data Table in Excel helps study the different outputs obtained by changing one or two inputs of a formula. A data table does not allow changing more than two inputs of a formula. However, these two inputs can have as many possible values (to be experimented) as one wants.

What is the difference between DataSet and DataTable?

A DataTable object represents tabular data as an in-memory, tabular cache of rows, columns, and constraints. The DataSet consists of a collection of DataTable objects that you can relate to each other with DataRelation objects.


1 Answers

Try this:

newTable = originalTable;
info(strfmt('%1 %2', newTable.recId, originalTable.recId);

newTable.data(originalTable);
newTable.insert();
info(strfmt('%1 %2', newTable.recId, originalTable.recId);

You'll see that the first statement just creates another one pointer to existing record. The second one creates new copy of existing record.

like image 167
ceth Avatar answered Sep 20 '22 01:09

ceth