Is DataTableFunctionLibrary "get data table column as string()" broken?

I’m trying to work out how to read the data of a DataTable with Python. My code starts with the “asset path” for the DataTable.

I would have thought you would use DataTableRowHandle, but I can’t actually find any “use” for it, and it doesn’t seem to have any method that returns the “content” of the row either. In other words, it’s basically useless in Python atm.

Although I haven’t yet found a way to list the “column names” of a DataTable, or the “fields” of the underlying UserDefinedStruct in Python. at least, the doc talks about “DataTableFunctionLibrary.get_data_table_column_as_string()”. Unfortunately, it doesn’t even seem to work. Am I doing something wrong, or is it buggy?

datatable_func_lib = unreal.DataTableFunctionLibrary()
string_lib = unreal.StringLibrary()
editor_asset_lib = unreal.EditorAssetLibrary()

# Path to table
asset_path = ...
# The table object
table = editor_asset_lib.load_asset(asset_path)

# Name of desired table column, as String
col_name_str = 'my_col'
# Name of desired table column, as Name
col_name = string_lib.conv_string_to_name(col_name_str)

# This works
row_names = datatable_func_lib.get_data_table_row_names(table)
# This is always an empty array
my_col_values = datatable_func_lib.get_data_table_column_as_string(table, col_name)

Off-Topic: Why am I not allowed to post, if I use “DataTableFunctionLibrary.get_data_table_column_as_string()” in the title?!?

hi ,
do you found a solution ?

have a nice day
Daniel

Depends on what you call a solution. As you can see, nobody else replied, so I assume it’s just not possible. So I gave up and started reading the “source” CSV files instead. As long as both are kept in sync, which is only easy for me because I’m the only dev, than I access the data that way.

hi

thank for your reply,
i tried your code and it’s working for me

but is a little strange you can’t loop each line!

Have a nice day.
Daniel

import unreal


datatable_func_lib = unreal.DataTableFunctionLibrary()
string_lib = unreal.StringLibrary()
editor_asset_lib = unreal.EditorAssetLibrary()

# Path to table
asset_path ='/Game/montreKF/c4d/K_F_Eight_refV2/NewDataTable.NewDataTable'
# The table object
table = editor_asset_lib.load_asset(asset_path)

# Name of desired table column, as String
col_name_str = 'Filter'
col_name_str2 = 'Material'
# Name of desired table column, as Name
col_name = string_lib.conv_string_to_name(col_name_str)
col_name2 = string_lib.conv_string_to_name(col_name_str2)

# This works
row_names = datatable_func_lib.get_data_table_row_names(table)
# This is always an empty array
my_col_values = datatable_func_lib.get_data_table_column_as_string(table, col_name)
my_col_values2 = datatable_func_lib.get_data_table_column_as_string(table, col_name2)

print(row_names)
print(my_col_values)
print(my_col_values2)

i create my structure:

create a DataTable from my structure:

Log from your script:

There is a getDataTableRow function in the blueprint but it is not exposed in python.
There might be some technical limitations preventing to expose it.
I logged it in the system Unreal Engine Issues and Bug Tracker (UE-131103).

It might be a late reply. But this worked for me:
my_col_values = datatable_func_lib.get_data_table_column_as_string(table, unreal.Name(“col_name”))