Trouble with UDataTable and GetDataTableRow

Now that I have managed to get a [custom datatable declared and imported][1] I have stumbled on a new problem.

You will notice that the link between “OutRow” on the GetDataTableRow Node is not linked to the BreakCrdDetail node. As far as I can tell this is because I have selected the DataTable from among my assets rather than via a variable. Although I can drag and connect this link and compile the game successfully, each time I open the editor the link is broken. If I try to run the game as a standalone it first recompiles the project, which means it breaks the link and then tries to compile it with the link broken, and then gives an error that it couldn’t compile the blueprint due to the missing link!

I had a very similar problem with [SpawnActorFromClass][3] where the output node changed to a default “Actor” each time rather than mirroring the input class, which caused the blueprint compile to fail each time for the same reason because the following node expected input of an actor subclass. In that project I could use a workaround to cast the output object to the specific class I wanted, but I can’t do that in this instance as there is no node to take the default “TableRowBase” object and convert it to “CrdDetail”.

I have tried this by just using the .h file only, as per the sample docs, and while I do indeed get the structure defined and I can import a .csv successfully, the link in the blueprint still breaks - the problem is with the node not with the UStruct.

So, I tried a new angle, suspecting the problem could be resolved by extending from the correct class (DataTable) rather than a generic UObject. I used “Add code to class”, expanded the dialog to expose all classes, and extended from DataTable. I stuck in the custom definitions from the original .h file, and tried to compile. It failed giving 3 “LNK2001: unresolved external reference” errors for UDataTable::FinishDestroy(void), UDataTable::Serialize(class FArchive &), and UDataTable::AddReferencedObjects(class UObject *,class FReferenceCollector &). From my reading on the topic of linker errors it would appear these functions are not publicly exposed by the engine and it requires a fix from the dev team, but I could be wrong. I added a #include “Card_Detail.generated.inl” reference in the .cpp, but got an error saying .inl files had been deprecated, so I removed it.

I understand that I could write my own overrides for these functions, but I wouldn’t want to create empty functions as there is no guarantee that I’d not be making the problem worse. I’d like to copy the source code, but I’m a bit lost at this point as to where it is as my primitive searching through the Unreal Engine/4.4 folder does not turn up any hits for “data” or “table”.

Can anyone point me in the right direction, or help me fix the issue with the blueprint link disappearing each time?

I wasn’t really sure whether to put this in the C++ or blueprint sections, as it impacts both, but the behaviour of the LNK2001 errors leads me to believe it’s a bug.

Here is the code (the project is called “Blank” because I’m just testing things, there is no map level or much of anything):

Card_Detail.h

    #pragma once
    #include "Card_Detail.generated.h"
    
    USTRUCT(BlueprintType)
    struct FCrdDetail : public FTableRowBase
    {
    	GENERATED_USTRUCT_BODY()
    
    public:
    
    	FCrdDetail()
    		: CName("")
/** other definitions cut */

    	{}
    
    	/** The name of the entry */
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CDet)
    		FString CName;

/** other definitions cut */

    };
    
    UCLASS()
    class BLANK_API UCard_Detail : public UDataTable
    {
    	GENERATED_UCLASS_BODY()
    
    };

Card_Detail.cpp

#include "Blank.h"
#include "Card_Detail.h"

UCard_Detail::UCard_Detail(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{

}

Ok, I’m going to give up on this now because the blueprint nodes just don’t work. It seems there was a node called “GetDataTable” that worked, but “GetDataTableRow” has always been bugged. GetDataTable has disappeared, and I have ver 4.4.3.

I even tried this:

According to [Data Driven Gameplay Elements in Unreal Engine | Unreal Engine 5.2 Documentation][2] all we need do is make a DataTableRowHandle. Except when one uses the handle in the blueprint as above, “Out Row” has no useful functions attached to it, eg Break (to anything, never mind the datatype you want).

As far as I am concerned, this stuff just doesn’t work in blueprints. Period.

And I’m not going to start on TAssetPtr always returning null from the break data row function…

Hi ,

The issue with the Out Row node of Get Data Table Row breaking when reopening a project is one that we are currently working on (TTP# 342230). Unfortunately we do not currently have a workaround for this issue.

This is still an issue with 4.5.0 Preview. Makes using DataTable tough if you have lots of csv’s…

The TTP for this issue is still open. I have not tested this with the released version of 4.5 that came out today, but I suspect the issue will still be present in the released version as well.

It’s not fixed in 4.5 release either. Data tables are still completely unusable in blueprints.

I did some debugging on the GetDataDableRow node and it seems to be a problem involving the order things are loaded. When the node is being reconstructed during project loading, the DataTable has not yet been deserialized so it doesn’t have a reference to the struct, causing the node to use the base row handle type instead.

Hi everyone,

I just wanted to provide a quick update on this issue. This has been fixed and is working in our latest internal build of the Engine. If you would like to test the fix yourselves, you can merge the fix into your Engine (if you are using an Engine built from source code).