Download

[FEATURE REQUEST] Better support for arrays in CSV DataTables

Now that I can edit Data Table contents directly within UE4, I can use Array types for certain cells and manually fill them out. My specific case involves a large data table which specifies all of the various parameters associated with player attacks; I have converted my “Damage” column from a single float to a float array, which lets me specify multiple damage values for each attack, which I can then pull with a “Get” node at the appropriate instance (for example, I can specify 5 values for a chargeable attack with 5 charge “tiers”, and use a get node to pull the appropriate one, rather than making a special set of BP logic specifically for that attack).

The problem is, even though this works behind-the-scenes of the engine, it isn’t very user-friendly. When viewing the data table, my “Damage” column is blank, and I can only see the appropriate values by clicking on that specific row. And, of course, I have to manually manage the data table myself, since importing it no longer works as expected and causes the engine to freak out at me.

So, my suggestions:

(1) Add a (hacky) way to specify multiple values in a CSV which are “in the same cell”, which will cause them to be interpreted as an array. By way of example, suppose that you use a “” or “~” or some other character which flags the distinctions. So if the engine is looking for an array of floats, and it reaches the comma which designates that column, and it sees “1\15\25”, it knows to interpret that as three array entries. Failing that,
(1b) At least make the CSV, on import, identify the value in the column in question as a single-item array. So for a cell which wants an array of names, interpret a value of “HammerArm” as a one-entry array with the single entry (at Index 0) being the value “HammerArm”. At least this way you can get CSVs working in a rudimentary way with arrays, even if it means that after-the-fact the user must go and change certain values to expand the “default” specified in the CSV.

(2) PLEASE display the values from arrays in the column when viewing the Data Table asset in UE4. As I said, I have an array of floats, and it looks like this:
486133be4b27036c0391d8bc8df58f0b43fc2234.png

It would be an absolute delight to see the values in that column, either (preferably) as comma or slash-separated values (i.e. Damage: 24, 48, 57), or at least just displaying the first entry of the array.

Thanks for your consideration!

Hi RhythmScript,

Thank you for your request, we will take this into consideration.

Hi RhythmScript,

A feature request for this has been added for the engineers to take a look at for future consideration. For your reference the ticket is UE-8294.

This has been done as part of 6af0f20199e5f59d6658d30e00a30900a5463206 (which relies on f715c7fbfac75868e5b744c4b77c1cc022710a6b).

You can now export, import, and view arrays in both the CSV and JSON DataTable formats.

For CSV they use our standard property export array format, eg)



"(10,20)"
"(""String1"",""String2"")"


For JSON they use a standard JSON array.

You are truly my hero.

Now if only there was an easy way to EXPORT my current data table back to CSV, so I didn’t have to retype changes by hand…

ah well! Thank you guys!

What format is your data table? If it’s a .uasset, I’ve also added the ability to export those to CSV in the above change :slight_smile:

UE4_ExportAsCSV.png

Well, shut my mouth.

Exceptional. That will enable me to export my current array-filled data table back to CSV whenever I want to do things like reorganize rows (which I very frequently want to do, and which the current uasset editor doesn’t allow).

That’s a pretty bad workflow just to re-order some rows :frowning:

I’ll look into adding that to the editor while I’m working on the other UI improvements.

Apparently the export feature does not work for field with the “Set” attribute. How are those supposed to be formatted in CSV or JSON? How about for fields done as maps?

I added map and set support to the Data Table import/export for 4.16.

Thank you! 4.16 keeps getting better. Just wish it was stable enough for production. :frowning:

Is there any place these import/export formats are fully documented with what types are supported? And I mean individually and not the generic reply “any of class X”. I’m going to hazard a guess that the import/export of sets and maps are going to be similar to arrays?

DataTableUtils::IsSupportedTableProperty lists the property types that are supported by Data Tables in general. If a property is in that list then it (and any derived property types) should support import/export.

As of 4.16 the list is: UIntProperty, UNumericProperty, UDoubleProperty, UFloatProperty, UNameProperty, UStrProperty, UBoolProperty, UObjectPropertyBase, UStructProperty, UByteProperty, UTextProperty, UArrayProperty, USetProperty, UMapProperty, UEnumProperty.

While that is useful information the short answer so far is “no”. You just described acceptable input but not how that input is formatted. This is information that should be under Learn > Documentation. No worries. I know just how much a pain it can be to fully document what you’ve coded.

Finding out how stuff is formated is trivial. Create a data table that has the type you need, enter something then export the table as csv. Look at the resulting .csv file and voila, you now know how to format it.

Actually I just tried that. It failed. But that’s still not documentation of a feature but a hack to figure out that feature. That’s why the developer just pointed out that 4.16 contains a fix to that problem. But he’s not on the documentation team who are right now asking for input on how to fix things like that. As fast as the engine is expanding they can be a bit overwhelmed. And that’s a bad thing as the code team also needs to check documentation to see where things are currently at.