Data Tables and Adding new rows via Blueprint

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

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.

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?

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.

It seems that if you want to make a connection with a MySQL database, you will have to make your own plugin in C++ :confused:
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).

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.

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

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:

	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

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

Just enable Json Blueprint Utilities Plugin

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]

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