How can I have a Row Name drop down from a data table as a variable input on a blueprint function?

Hi there.

So imagine I have a function called ‘AddItem’. In it, I get a data table row by Row Name. However, I’d like to extend the drop down list seen here to the ‘Item’ input on the function so that I can directly select a valid item in the Data Table without having to enter a name manually.

However, after hooking up the ‘Row Name’ to the ‘Item’ input, when the function is called, there is no drop down.

Ok, so I thought maybe I could resolve this issue by similar means found [here in this similar question][3]. Which does work on instances of an actor, but not for functions. I created the DataTableRowHandle and set that as an input, which did not work.

As you can see here after breaking the struct, and setting the Data Table as the correct Item, the drop down does still not appear.

How would I go about doing this? I really don’t mind if I have to create a C++ BPFL or something similar to achieve this. It would be a huge time save in the end.

1 Like

The row name is determined by the value in the first column of the table row. If you want it to be something other than numbers you can just make it so that other column is the first one on the left, but you better make sure all the values in it are unique among all rows.

Sorry. Perhaps my question wasn’t clear.

I understand what you’re saying, but that’s not what I’m looking for. I’m asking if I can have that drop down from the Data Table pushed outside the function. So that when I call the function from somewhere else, I can see the same drop down list I’d see when I’m inside the function.

In that case, i believe there is a node you can use from the data table which returns all the row names in an array. You can use That array to help populate other lists and set text labels on newly spawned widgets etc.
Unfortunately I dont remember the exact name of the node. Probably GetTableRowNames or GetTableKeys or something like that.

Did you ever find a workaround for this?

For anyone who looking answer for it.

Probably, there is no way to make it works in Blueprints.
But if you know C++ start looking into K2Node’s implementations, especially for UK2Node_GetDataTableRow class and how it receives updates from SDataTableStructComboBox.

hello
id like to know if you found an answer… i have a similar problem filling row names automatically
C++ or python script help - Unreal Engine / Programming & Scripting - Unreal Engine Forums

I’m struggling with the same thing… any updates? :smiling_face_with_tear:

You can do it in C++ by using the DataTablePin metadata specifier.
Here’s what your function’s header would need to look like:

	UFUNCTION(BlueprintCallable, meta=(DataTablePin="ItemsTable"))
	void AddItem(UDataTable* ItemsTable, FName RowName);

Since it is BlueprintCallable, you’ll be able to use that function in your BPs.

If you want to implement the function’s internal logic in BP rather than C++, you can just make your BP class inherit the C++ class and override the function in the BP.

2 Likes

Really thanks!!! I was putting the wrong value inside DataTablePin, you saved me!