Get random data table ROW NAME?

I created a data table, the row names are all unique integers (A1 is empty). I have selected the appropriate data table name but the ‘Row Name’ node only lets me slect from a drop-down list.

How can I get it to load a random row name from the table? Doesn’t seem to be much I can put into that node.

In the right-click menu, if you search for data table you’ll see a node called “data table row names”. Selecting the same data table you get an array of all the row names.

Then, you can Get() the Name of any index of the array. The Index could be randomized between 0 and the arrays Last Index().

1 Like

If the row names are integers that are sequential, you could get a random integer, and convert it into an FName that you would feed into the node. You do not have to manually specify a value from the dropdown.

Sorry For the hard necro but Ive been scrolling for days.

How would you go about converting an integer into a Row name?

I need to choose the the Row on my data table by the incoming integer.

I just cant think of the nodes to do it.

Native way:

using “data table function library” on the marketplace, which has this node:
image

(of course you need to make sure the random integer is within the range of the data table rows if you are doing it randomly)

3 Likes

Thank you for the ultra speedy reply.

Interesting So essentially your getting the array of row names and the nchoosing it via a integer. makes sense.

Just before you messaged I found another way but arent to sure on it overall.

Basically I used an “to string (integer)” node converting it to string and then dragged it directly onto the get data table row name which converted the string into name. It works great but Is this way a bad way to go about it?

Hey, so first thing, just in case you don’t know, most anybody responding here is just other developers like yourself. Just people helping people. So speed in a response is just a matter of who happens to be looking at the same time is all :).

The way I have done is what I believe to be pretty much the only way. There is only a couple blueprint nodes for handling data tables. Essentially you just need to get an array of all the rows, and the only way to do that is to get all row names. Then, as with any array, you can extract an index.

What you have describe I don’t think makes sense exactly.
If you convert an integer to a string, what is the result? You can use a print string node to determine that.
I am not sure what the result will be, but it is having no context to your data table, right?

I may be misunderstanding, but I did a quick test.

So if you convert an int to a string, the result is just formating. Like it will turn 1 to 1. The only difference is that it will be read as a string, rather than an int. So that doesn’t really do anything.
Converting to a name is just another format conversion. THe final result is still going to be 1 - it’s just read as a Name.

If I understand correctly, you need to grab the contents of a data table row, and your input is a row index? In that case, I am like 80% sure the only way is to do what I showed above. Of course if you have something else that is working this just means I misunderstood your question.

Yeah sorry, I think Im poorly explaining it.

Im using a get data table row node (the data table contains images, Positions etc) and uses a function afterwards to tell it what to do with the stuff inside the data table. which I can control the rows manually But would like it controlled by an integer(But tbh its just text coming in from a spreadsheet csv file.).

But I need to tell the data table which row image to show at any given time.

So it goes a bit like this.

Csv spread sheet with Armour(NameRow) and 1(Integer in that coloum) enters the function. It hits the adding system and ejects a value between 0-10. this then gets converted into string then to a name and directly into the get data table row node(Into row name)

Then that uses the that value to show the related row (Image related to it), All the rows names in the data table are all numbered as well from 0-10.

works really well. But wasnt sure if I was being hacky af.

not sure I follow exactly. Some pictures might help. But if you got it working, that’s all that matters

Create a variable “Rows” of Name Type, set as an Array.
Get Data Table Row Names → For Each Loop → Add to “Rows” variable.

You now have a complete array of all row names in the data table.

Rows → Random Array Element → Get Data Table Row

1 Like