I get crash for the following code, when trying to exctract all rows from my datatable.
UDataTable* GameObjectLookupTable;
static ConstructorHelpers::FObjectFinder<UDataTable>
GameObjectLookupDataTable_BP(TEXT("DataTable'/Game/DataBase/countries.countries'"));
GameObjectLookupTable = GameObjectLookupDataTable_BP.Object;
TArray<TArray<FString>> rows = GameObjectLookupTable->GetTableData();
for (int i = 1; i < rows.Num(); i++) // ignore title row
{
TArray<FString> cols = rows*;
for (int j = 0; j < cols.Num(); j++)
{
FString col = cols[j];
UE_LOG(LogScript, Log, TEXT("%s"),*col);
=> GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, col);
}
}
strange that debugger shows col is an array with 2 items, however it should be an FString by declaration.
GameObjectLookupTable is valid and I get 4 items for row, 5 items for col which seems ok, however it crashes on 1st iteration when I try retrieve the string column value.
any help greatly appreciated
As I understand it, each row in a datatable represents a struct that you defined earlier.
Say your struct is called FGameData, you would do something like:
int32 maxItems = GameDataTable.DataTable->GetTableData().Num();
for (int32 i = 1; i < maxItems; i++)
{
GameDataTable.RowName = FName(*FString::FromInt(i));
FGameData* MyData = GameDataTable.GetRow<FGameData>();
// Do some Stuff with MyData
}
thanks, this probably works, though Im confused, as I have UDataTable* from constructor finder (for my existing CSV datatable asset), and I dont have .rowname or getrow() property/method here… 
I have directly
GameObjectLookupTable->GetTableData();
what datatype does have GameDataTable in your sample?
thanks
It’s a FDataTableRowHandle
so it would be
FDataTableRowHandle GameObjectLookupTable
and in your constructor:
GameObjectLookupTable.DataTable = GameObjectLookupDataTable_BP.Object;
Sorry I didn’t think of it, hope it helps 
thanks again, it works, though the success isnt 100% 
I can read integers (uint8) from row correctly, but it still crashes on FString, when I want log/display it on screen.
maybe I cant use FString as property of datatable/row…?
Mhh, In one of my previous projects I had several DataTables with FString properties and could use them perfectly fine, so I’m pretty sure that works…
Maybe try running your function with a regular FString (not extracted from datatable) and see if it still crashes
okay it is fine.
somehow AddOnScreenDebugMessage failed on this string, but I can log and use it without problems.
(no special chars just country names so it is weird.)