Set data table row?

Hi,

I have a data table that is connected to a struct. Now I know that by calling the node “get data table row” will get the row from the data table.

Now is there a way that I can write into the data table? I cannot seem to find a node that allows me to change a variable in the data table.

Thanks.

1 Like

Can anyone help? I still can’t find a way to add a row in a data table.

You add data to the data table by opening it and manually adding rows.
There is no way, through blueprint, to change the data table.
Maybe it would be possible through C++ to somehow write to it and update it during play but I wouldn’t know how to do that.

Now I see that I’ve not been clear enough when first posting the question. Yes I know that I can manually add rows in the editor, but I wanted to know if there was a way to change the data in the rows in runtime using blueprints.

It’s weird that there is an entity such as data table in Unreal, but no implemented functions for it to change or add new data to it. Then why make such a feature in the first place when you don’t give full functionality over it.

I know this is old but i am trying to do the same thing, spent 5min so far but i imagine you can just create seperate data tables for each situation and switch out the whole data table?

I do use Fill Datatable from JSON String

3 Likes

Data table only store data, information.

They are only readable.

But you can store their informations in an array and retrive or manipulate by it.

2 Likes

Basically what OP wants doesn’t exist.
you need to extract the data, create a multidimensional array for it (or maybe a Map depending on what you need), and modify the data on those at runtime.

1 Like

This can be accomplished by just using AddDataTableRow blueprint node.
Give it the same RowName as an existing row and it will just simply override it.
Use Set members in “rowtype” for modifications.

Something like:

1 Like

Came here from Google… That node doesn’t come up for me (Add Data Table Row).

I’m trying a similar setup to this, but can’t make it work. Nothing is written or updated in the data table. I’ve tried a couple of different variants to see if it’s possible to add a completely new row (instead of updating one) but can’t seem to write to the table at all. I’m a bit confused as to what the point of the Add Data Table Row function is.

Worth mentioning is that I’m running this from an Editor Utility Blueprint.

1 Like

Doesn’t do anything for me either. Last time I stumbled upon this thread a few weeks ago, ending up rebuilding a json string to recreate the whole dt everytime I wanted to add a new entry. This time i just needed to modify entries so I remembered this post and tried the Add Data Table Row to modify a existing entry, the node just doesn’t work for me, neither adding new rows or modifying existing rows…

Make sure you save the asset when your done, or nothing will update. There is a save asset node.

Same situation occurred when I using the AddDataTableRow blueprint node, which had no effect. Then I found that there was an issue with the input of the Row Data node. The input struct needs to be a C++ struct inheriting from FTableRowBase; Blueprint struct will not work.

I heard making data assets could help, similar to how it was suggested earlier to make arrays or maps. Now, i also saw some sort of youtube video of a plugin, perhaps someone coded a solution in C++ for this issue. But i am not sure if that really adds rows or only fills existing ones.

in another thread i found this comment:

The way unreal works them, the data tables arent saved or stored after editing, which is why you can’t change a table row.

On the other hand, pulling whatever into a map, allows you to store the data in the save game and re-load it - which contrary to popular hearsy is what you want when you are looking to write something somewhere.

So whats your best alternative option?
Well, the save game file is encrypted and offers some basic prodtections against easy hacks (you need to create a save game editor to unpack, make changes, re-pack).

The only other alternatice that could be secure is to custom write (system.IO from c++) a custom encoded file that your software has a key to decode. You could use some simple Base64 encoding, or some more complex options. Save the encoded data to any text file.

The problem with that in a game is that windows or apple will shut your game down if you write files to unauthorized directories.
And that the autorized ones are normally nowhere near the executable (%appdata% is probably a safe place for windows. Apple has its own system for app data, you would need to use their file save stuff to source the app’s correct data folder).

Supporting both systemes becomes a nightmare, which is likely why Epic never properly implemented the blueprint version of saving/changing tables.

So, probbaly, just stick to pulling data from a table, placing it in a map variable, and saving that map variable for re-use…

1 Like

You cannot modify data tables at run time, the point of them is to hold pre designated data for calling upon later, instead of loading actors or new variables into memory at runtime. What you can do is assign the struct as a variable to an actor and set it’s values there but this won’t affect a data table