# UDatatable Loading outside Constructor (Dynamically)

**URL:** <https://forums.unrealengine.com/t/udatatable-loading-outside-constructor-dynamically/455410>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 16, 2019, 5:11am UTC](https://forums.unrealengine.com/t/udatatable-loading-outside-constructor-dynamically/455410 "2019-09-16T05:11:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![atanknomore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atanknomore](https://forums.unrealengine.com/u/atanknomore)\
**Post date:** [September 16, 2019, 5:11am UTC](https://forums.unrealengine.com/t/udatatable-loading-outside-constructor-dynamically/455410/1 "2019-09-16T05:11:42Z")

</div>

Hey all,

I’m trying to set up a dynamic calling for UDatatables. My system setup is the following: there is user input which determines a set of profiles. Depending on the profile output, the player will load a UDataTable (Final Directory is selected on runtime).

I want to load the UDataTable outside the Constructor. I know that the Constructor method is:

```
	const TCHAR* TempChar = *DataTableReference;
	static ConstructorHelpers::FObjectFinder<UDataTable> temp(TempChar);
	UDataTable* DataTable = temp.Object;
	FString Context; //
	if (DataTable != nullptr)
	{
		TArray<FName> Names = DataTable->GetRowNames();
		for (int X = 0; X < Names.Num(); X++)
		{
			//Do something. Find Row Function -> * (DataTable->FindRow<FStructure> (Names[X], Context, true))

		}
	}

```

Based on Googling, I found that one can load things with UObjectLibrary

> **[UObjectLibrary](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Engine/UObjectLibrary/)**
>
> Class that holds a library of Objects

However, I don’t seem to understand how to do it this way.

I also looked into this one:

> **[UE4 dynamically load data table - Programmer Sought](https://www.programmersought.com/article/903744849/)**
>
> UE4 dynamically load data table, Programmer Sought, the best programmer technical posts sharing site.

But don’t know how to transform the FString to the structure that I’m after.

I dove into trying to understand it this way too:

> **[Asynchronous Asset Loading](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/AsyncLoading/)**
>
> Methods for loading and unloading assets during runtime.

but nothing is working so far.

How does one approach this? Thank you in advance.

---

<div class="post-metadata">

**Author:** ![atanknomore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atanknomore](https://forums.unrealengine.com/u/atanknomore)\
**Post date:** [September 16, 2019, 6:22am UTC](https://forums.unrealengine.com/t/udatatable-loading-outside-constructor-dynamically/455410/2 "2019-09-16T06:22:16Z")

</div>

Feeling kind of dumb for having missed it but I had totally forgotten about Load Object.

This Worked:

```
   UDataTable* DataTable = LoadObject<UDataTable>(NULL, *DataTableReference, NULL, LOAD_None, NULL);
	if (!DataTable) return;
	FString Context; //
	TArray<FName> Names = DataTable->GetRowNames();
    if (!Names.Num()) return;
	for (int X = 0; X < Names.Num(); X++)
	{
		//Do something. Find Row Function -> * (DataTable->FindRow<FStructure> (Names[X], Context, true))
	}

```

Leaving this for reference if anyone ever needs it.
