# Table duplication

**URL:** <https://www.dynamicsuser.net/t/table-duplication/53395>\
**Category:** Developer Forum\
**Created:** [June 19, 2014, 6:53am UTC](https://www.dynamicsuser.net/t/table-duplication/53395 "2014-06-19T06:53:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckanth](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@ckanth](https://www.dynamicsuser.net/u/ckanth)\
**Post date:** [June 19, 2014, 6:53am UTC](https://www.dynamicsuser.net/t/table-duplication/53395/1 "2014-06-19T06:53:51Z")

</div>

#### Hi all,

In the below code I created a duplicate table. But how can I pass that duplicate table in dictTable = new DictTable(—???–);

* * *

#### DictTable dictTable;#### Common common;#### dialogSource = dialog.addField(extendedTypeStr(TableName),“DataSourceTable”);#### treeNode = TreeNode::findNode(#TablesPath);#### treeNode.AOTfindChild(dialogSource.value()).AOTDuplicate();#### SqlDataDictionary::synchronize();

#### dictTable = new DictTable(—???–);#### common = dictTable.makeRecord();

Thanks & Regards,

Rk.

####

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [June 19, 2014, 7:41am UTC](https://www.dynamicsuser.net/t/table-duplication/53395/2 "2014-06-19T07:41:35Z")

</div>

_AOTDuplicate()_ returns another _TreeNode_ instance and you can get the new name by _treeNodeName()_ - it will be _CopyOf\*_. Then you have to either convert the name to table ID _(tableName2Id())_ or to create the instance by _SysDictTable::newName()_.

May I ask what problem are you trying to solve by duplicating tables at runtime?

---

<div class="post-metadata">

**Author:** ![ckanth](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@ckanth](https://www.dynamicsuser.net/u/ckanth)\
**Post date:** [June 19, 2014, 10:31am UTC](https://www.dynamicsuser.net/t/table-duplication/53395/3 "2014-06-19T10:31:33Z")

</div>

Hi Martin,

My requirement is copy the selected records from a form grid and save into a StoringTable . Here I need to create the table(StoringTable ) dynamically and this table structure same as form grid datasource table structure. For this I am trying to duplicate the grid datasource table. Please let me know is there any way with out duplicating the table. And my Ax version is R2 CU6.

Thanks & Regards,

Rk.

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [June 19, 2014, 10:40am UTC](https://www.dynamicsuser.net/t/table-duplication/53395/4 "2014-06-19T10:40:45Z")

</div>

Forget about storing tables and form grids and tell me what’s the _business requirement_.

---

<div class="post-metadata">

**Author:** ![ckanth](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@ckanth](https://www.dynamicsuser.net/u/ckanth)\
**Post date:** [June 19, 2014, 2:17pm UTC](https://www.dynamicsuser.net/t/table-duplication/53395/5 "2014-06-19T14:17:56Z")

</div>

In a form select some records and when we click on a form button on that time a is table created with that selected records.
