# How to save DataTables at edit time from code?

**URL:** <https://forums.unrealengine.com/t/how-to-save-datatables-at-edit-time-from-code/1879711>\
**Category:** Programming & Scripting\
**Tags:** datatable, unreal-engine, saving, editor, question, CPP\
**Created:** [May 29, 2024, 8:47pm UTC](https://forums.unrealengine.com/t/how-to-save-datatables-at-edit-time-from-code/1879711 "2024-05-29T20:47:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DentonJC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DentonJC](https://forums.unrealengine.com/u/DentonJC)\
**Post date:** [May 29, 2024, 8:47pm UTC](https://forums.unrealengine.com/t/how-to-save-datatables-at-edit-time-from-code/1879711/1 "2024-05-29T20:47:23Z")

</div>

I have a data table which I populate at edit time using:

`MyDataTable->AddRow(MyStruct->ComponentTags[0], MyData);`

and then I want to save it using something like:

`UPackage::Save(MyDataTable->GetPackage(), MyDataTable, RF_Public | RF_Standalone, MyDataTable->GetPackage()->FileName.ToString().GetCharArray().GetData());`

But because the MyData struct is apart of a specific class, and contains pointers to uproperties in that class, I can’t save it. I get this error:

`Can't save MyDataTable.uasset: Graph is linked to object MyDataActor (Referenced because it is an archetype object) in external map`

Any way I can get around this? I really don’t want to have to save my data to CSV or some other format and do a bunch of conversions if I can avoid it.

Thanks!

---

<div class="post-metadata">

**Author:** ![Arodi007](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arodi007/32/1022275_2.png) [@Arodi007](https://forums.unrealengine.com/u/Arodi007)\
**Post date:** [May 30, 2024, 6:33am UTC](https://forums.unrealengine.com/t/how-to-save-datatables-at-edit-time-from-code/1879711/2 "2024-05-30T06:33:17Z")

</div>

If there no other solution, you could try with bp with the Editor Utility to add rows to data table.  
(min ue 5.3)

---

<div class="post-metadata">

**Author:** ![DentonJC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DentonJC](https://forums.unrealengine.com/u/DentonJC)\
**Post date:** [May 31, 2024, 4:26am UTC](https://forums.unrealengine.com/t/how-to-save-datatables-at-edit-time-from-code/1879711/3 "2024-05-31T04:26:00Z")

</div>

thanks!  
I ended up just converting the MyStruct to a JSON string instead and storing that in the data table. I was also able to deserialize the struct from JSON back into the struct again so it worked out nicely
