How do I find the row name?

Hi,

I have datatable where I look through, comparing current data with that of the data table rows. If a match is found, then there are some extra variables stored in that row that I use. For example a colour that needs to change in that situation.
I want to be able to save the row name to a save game so I can just click on a button and find that row using its row name. This way, I don’t have to setup the system when testing a single row in my datatable.

My problem is that I can’t find a way to grab the row name of a specific row. How would I do that?

Thanks in advance!

My problem is that I can’t find a way
to grab the row name of a specific
row. How would I do that?

But row name is just that. A Name type variable.

What am I missing? What is stopping you from saving the variable in a save game:

323796-screenshot-2.jpg

What’s more, why not save the entire struct since you already have it. This way, you do not need to look anything up (but the save game will be chunkier…)

What I want is to access the row name through the row object.

When my program starts, all the rows get imported and are added to an array of custom structs with custom data types. This array is where I check each row and compare it against what I want.

You gave me the idea to store the row name inside this struct so now each ‘row’ has it’s name embedded. Thanks!

  1. Use Get Data Table Row Names to get all the names in the list as an array.
  2. Then, Use For Each loop for the array you obtained. In each loop, you can try to do what you want to do for each row

Hope it helps you :slight_smile:

So basically to get row id from my data table, I have put the data in the table twice? Once into first “name” column, and then to some other column, because there’s no way to take it from column 0? Niiiiiice!

1 Like

It helps, but THIS IS NOT HOW DATA BASE IS SUPPOSED TO WORK.

Wait is this true? Im cant seem to find Row name at all? Does this just not exist? do I need to make another Row just to fill all the same numbers again just to find a specific row?

No you dont need to add an extra column just for identification. The Row Names column is always added by default and its purpose is for getting rows by name.

If you can explain what you are trying to do in simple language, it is going to be easy for somebody to show an example of what nodes you need to do it.

Im making a csv make your own adventure game, I need to do the achivements which means finding out what page Im currently on (Page=Rowname) My Row name isnt a variable of any kind, Literally just seems to be an index of some type. (the first 2 columns look like an index per row and a name I assign to each row both of which I couldnt find)

I couldnt seem to figure out how to find out which rowname im currently on so insted I duplicated the Row name into a variable inside the csv/structure/data table and accessed that insted like I have done with the rest of the infomation.

Itd love to know of an alternative, although this works fantastically well.

I’m confused what you mean exactly.

What is a page? How are you changing pages? How is this associated with a data table row? Can you show step by step your code and what changes it makes in your game?

I agree, just ran into this and it’s a strange omission even in UE5.

1 Like

I ran into the same problem and that’s the way I solved it:

  • I Added a FName Name; property to my row, which I don’t fill up by hand
  • At the time I request any row I know it’s primary key (Name) and simply copy this value over to the result

This way I can always read out the Name of the row, wherever I have a reference to it.

This integrates very well into my Repository System

FItemClass* UItemDataRepository::Find(FName Name) {
	static FString ContextString = "ItemDataRepository";
	TObjectPtr<FItemClass> ItemClass = ItemClassTable != nullptr ? ItemClassTable->FindRow<FItemClass>(Name, ContextString) : nullptr;
	if (ItemClass && ItemClass->Name != Name) {
		ItemClass->Name = Name;
	}
	return ItemClass;
}

Maybe I missed something, but this works for me.

1 Like