[Request] Data Table variable type

Has there been any updates on this? This is still something I find can be very useful and powerful. If issue is structs, not being able to be changed. Can it be implemented anyways with that setup? I’m amusing that, if data tables are setup same (struct doesn’t change) but just have different text will help with organization as well. Instead of having to have 1 large clustered Data table, we would be able to use multiple of same data tables. This is most basic way this could help.

Hello Hawk,

There has not currently been any update regarding this feature request. Our developers are currently focusing their efforts on high-priority crash and showstopper bugs.

Have a great day

I just create variable in C++, it’s easy:

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Crafting")
 UDataTable* CraftingDataTable;

After that you can use it in blueprints just like you would use a blueprint variable.

Where do you put this in C++, is that all you need surely not?

Hey everyone,

Just wanted to update and provide link to public bug tracker so you can all keep up with status of request: Unreal Engine Issues and Bug Tracker (UE-23282)

Yes you can create a reference to a DataTable in C++, for instance inside a USTRUCT(A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums), BUT this won’t help you in Blueprint as only thing you will be able to do with that reference… is to get Row Names of that Data Table, you won’t be able to connect it to a GetDataTableRow node (as it only accepts literal values), hence you won’t be able to retrieve object / struct of that “variable” Data Table.

Also tedious, parsing solution of begounet would work.

After some thoughts, there are several workarounds, depending on time you want to spend on it.

An Easy but Trashy solution that should work in most cases:

  1. Create your own reference system
  • Create an enum, let’s say EDataTableRef

  • Manually populate this enum with name of Data Tables you want to reference (DTA, DTB, DTC, etc)

  1. In a Data Table DTA, let’s say you want to reference another Data Table DTB, instead of using a true UDataTable reference, use previously created enum:
  • Add enum: EDataTableRef MyOtherDataTable;

  • Add Row Name: FName RowNameOfThatOtherDataTable;

(magic is nearly done)

  1. Create a BP Function Library and for each of your Data Table, create a Getter: GetDTA, GetDTB, GetDTC, etc.
  • input node takes RowName

  • GetDTA will have a UE4 common GetDataTableRow and output a DTA (etc)

  1. In your system, when needing right UStruct, switch on your new reference (EDataTableRef) and use proper function created above

For many problems it should be sufficient but of course, this system is not ideal and with too many Data Tables, it will also be tedious ! You have to create 1 enum value and 1 getter function by DataTable you want to reference.

main problem of this trashy solution is… You would be tempted in your BP FunctionLibrary to create a general Getter (who would not ?) that simply takes your new reference system (EDataTableRef and FName (Row)) and make general switch there on your reference to send you back right value. Yes but… as far as I know, you can’t because you can’t use a generic UStruct in your return node and later cast it to right UStruct. In consequence, your return node can not share a single pin for all of your return types and you return node would have as many pins as you have Data Table referenced… Still possible, but doesn’t feel right and I prefer to make a simple switch in my code as described above.

I can think of another solution involving copy of UStruct data in a UObject, so you can create a generalized GetDataTableRow based on this new reference system and still have a return node with a single pin/return value of type UObject, that you could later cast in proper data type.

Bests

If you are compiling engine, you can get data table as a variable type by doing modification shown here, while you wait for 4.15.

Thank you so much!!! this was so helpful!

Hi referencing data table is very necessary as i find it only way to add data from external source. This is highly reducing flexibility of system and power provided by datatable feature of unreal. Please take a note of it.

What is outcome? linked issue does not point to an active link any more.