# Data Tables and Adding new rows via Blueprint

**URL:** <https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586>\
**Category:** Platform & Builds\
**Tags:** Steam, datatable, Structure, unreal-engine, UE4, Blueprint, question\
**Created:** [April 2, 2016, 6:34am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586 "2016-04-02T06:34:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noobular](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Noobular](https://forums.unrealengine.com/u/Noobular)\
**Post date:** [April 2, 2016, 6:34am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/1 "2016-04-02T06:34:56Z")

</div>

Essentially What i’m trying to do is Get datatable row info on “SavedLevelData” [Like saves your level, exp, steam id, name)

[http://puu.sh/o32eY/3bf252c35d.jpg](http://puu.sh/o32eY/3bf252c35d.jpg)

and i can’t figure out how to make new rows, I want to make a new row with that playerid as the name (other stats are default and don’t need to be added other then display name

Also should I just put this on the controller so when the controller/character joins it will automatically attempt to create the players data? if i were to make this a function and put it on eventbeginplay?

I think a better way to phrase it, is i want to insert the characters info into the table.

---

<div class="post-metadata">

**Author:** ![Begounet](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Begounet](https://forums.unrealengine.com/u/Begounet)\
**Post date:** [April 2, 2016, 9:40pm UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/2 "2016-04-02T21:40:31Z")

</div>

Datatables cannot be modified. But you can use a simple array of the structure you would use for the datatable, and use the standard save system (save game slot).  
Should it be enough for your needs?

---

<div class="post-metadata">

**Author:** ![Noobular](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Noobular](https://forums.unrealengine.com/u/Noobular)\
**Post date:** [April 3, 2016, 10:50am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/3 "2016-04-03T10:50:27Z")

</div>

No, only from what i get is the save game slot, is the same as a local save of your game and mine i’d like mysql but i can’t figure it out since i only do some blueprinting and not c++ (atleast the part with integrating it into the game.  
Game would be multiplayer with a dedicated server.

---

<div class="post-metadata">

**Author:** ![Begounet](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Begounet](https://forums.unrealengine.com/u/Begounet)\
**Post date:** [April 3, 2016, 11:57am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/4 "2016-04-03T11:57:02Z")

</div>

It seems that if you want to make a connection with a MySQL database, you will have to make your own plugin in C++ 😕  
But I don’t see how you relate the UE datables and MySQL databases. They are very different things. You can see the UE datatable as a bank of data to drive values of your gameplay (for example, a loot table).

---

<div class="post-metadata">

**Author:** ![Noobular](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Noobular](https://forums.unrealengine.com/u/Noobular)\
**Post date:** [April 3, 2016, 12:03pm UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/5 "2016-04-03T12:03:56Z")

</div>

Yea, I thought they were practically small in engine databases where i could actually use them as a local mysql database. … well local for the server.

---

<div class="post-metadata">

**Author:** ![failrate](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@failrate](https://forums.unrealengine.com/u/failrate)\
**Post date:** [October 25, 2017, 6:18am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/6 "2017-10-25T06:18:37Z")

</div>

If you want to save your game, UE4 has a built-in you can use: [https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html](https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html)

---

<div class="post-metadata">

**Author:** ![danie\_grobbelaar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@danie\_grobbelaar](https://forums.unrealengine.com/u/danie_grobbelaar)\
**Post date:** [February 16, 2024, 1:07pm UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/7 "2024-02-16T13:07:30Z")

</div>

Would like to share how to add a row to a Data Table that is using blueprint structs.  
Unfortunately this only works in editor and can’t do a packaged build with it.  
In the header file:

```auto
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, meta = (CustomStructureParam = "Struct"))
	void AddToDataTable(UDataTable* inDatatable, FName inRowName, const FString& JsonStructString);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void RemoveDataTableRow(UDataTable* inDatatable, FName inRowName);

```

In the C++ file

```auto
void U::AddToDataTable_Implementation(UDataTable* inDatatable, FName inRowName,const FString& JsonStructString)
{
	FString localDatabaseString = inDatatable->GetTableAsJSON();
	FString localJsonStruct = JsonStructString;

	localDatabaseString.RemoveAt(localDatabaseString.Len()-1,1,true);
	localJsonStruct.RemoveAt(0,1,true);

	localJsonStruct = ",{\"Name\": \"" + inRowName.ToString() + "\"," + localJsonStruct;
	localDatabaseString = localDatabaseString + localJsonStruct + "]";
	
	inDatatable->CreateTableFromJSONString(localDatabaseString);
}

void U::RemoveDataTableRow_Implementation(UDataTable* inDatatable, FName inRowName)
{
	inDatatable->RemoveRow(inRowName);
}

```

![Screenshot 2024-02-16 145305](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/4/e34d474c40d3805f75897c511e90a6ae78460065.png)

Just enable Json Blueprint Utilities Plugin

---

<div class="post-metadata">

**Author:** ![mlagares](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mlagares](https://forums.unrealengine.com/u/mlagares)\
**Post date:** [February 21, 2024, 6:53pm UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/8 "2024-02-21T18:53:21Z")

</div>

After wasting a lot of time messing about with different suggestions I found short of using reflection this is the only method that actually works for adding rows to a table with data from C++. It appears the plugin is experimental so perhaps use with caution but it worked first time- Thanks you so much [danie\_grobbelaar]

---

<div class="post-metadata">

**Author:** ![danie\_grobbelaar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@danie\_grobbelaar](https://forums.unrealengine.com/u/danie_grobbelaar)\
**Post date:** [March 15, 2024, 9:26am UTC](https://forums.unrealengine.com/t/data-tables-and-adding-new-rows-via-blueprint/352586/9 "2024-03-15T09:26:18Z")

</div>

Unfortunately, I found out just now, that this only works in editor and cant do a packaged build with it.
