Download

Data Tables General Discussion

Hey guys this is more of a best practices/usages for data tables in Unreal. The standard method of creating a table in say a text file or spreadsheet seems to be redundant when it comes to Unreal, particularly in Blueprint. I say this because I feel like I am doing double the work if I create a text file, then a struct with all the same stuff in it, then have to populate the struct, and then do something with the data. My thoughts on this are, since I have to create the struct anyway I might as well write everything I need right there. The only thing I can think of when doing it the old-school way is maybe for portability say for moving said file to another project, for backup, or a server. But even when creating them in other engines or just working in C, I always wrote the data out to a file rather than creating a separate file and importing it into an empty struct. I don’t know. Maybe I just don’t have as much experience with them. Any thoughts?

I don’t follow. You create a struct that represents the columns in a *.cvs file (or json) , drag and drop the *.cvs file into the content browser and a Data Table is born. [HR][/HR]
In an ideal world drag-dropping a file would create the appropriate struct automagically, sure. In an ideal world BPs would read/write from/to a *Database and *utilise some juicy functionality, and were capable of reading many file formats.

What do you mean? Even if you have 10000 lines?

This is where I feel my experience has reached its limit. Regardless of how many lines, how else would you write it? It doesn’t write itself, right? At some point you have to manually input the data. I mean, there are some cases where I think it could like say on an email client that automatically adds a user to its list. But that user is still inputting their info into a form. Is there a better way?

You can always just manually edit the table directly - and skip the import step.

Data Tables were designed to be static. You create data in an external file, import it and use (read it) - you can’t write to DT from blueprints, not run-time. In 99% of cases it would be more sensible to take advantage of a proper word processor / spreadsheet anyway. While manually editing is possible (and some improvements were made recently, I believe), it’s still quite awkward / impractical most of the time.

There is a thread on AH somewhere where another user and myself messed around with uploading an actual dictionary as a DT; with some half a million entries or so it worked surprisingly well :slight_smile: [HR][/HR]
Another cool trick with DT is that they can be exported to a file. So you can manually fill in a single row in the editor, get the formatting right (like a nested struct with class references, ehm) and then replicate that format in Excel much more easily with *find & replace *for example.