How do I access the Data Table row

I have a 10-row DataTable setup…what I want is to be able to have the map start at index 0 when I click the next button go to the next row and so on… I don’t know how to reference the index number in order to +1 to move to the next row.

Also looking at doing the opposite of the next button with a previous button and having a play button so say every 5 sec it will automatically go to the next row…

Right now just looking for an example of how to and what variable to use to move back and forth between rows

@Everynone you helped me with an earlier version of this…have any idea where to start with this

1 Like

Can’t listen to the vid atm, but if you’re attempting to step through DT’s rows:

You may want to work in a clamp so we do not exceed bounds.

so what i would do is to create a variable “Row Index” and set the value to the row I want. In the example I’m just starting from 0 and incrementing the value by one when some button is clicked. Off course you will need some logic to get back to 0 if you want to start from the first row again. You could check if the int is greater than the number of rows. Similar with the lower part of the example

Then when I need a row from the table we first get all the row names and we receive an array of names.

I can get a particular row name by requesting a “copy” of one of the value of this array. We need to pass a index for this “get” node. We pass the index we have.

Just look at how arrays work in unreal if you are not familiar with this “get node” Drag from the array output not and use “Get (a copy)”.

The list of names is just an array of names, we get one of these names from a specific index.

The “get data table row” wants a row name. so we pass it the name we’ve got and we receive the value we need.

The example bellow is showing where to update the index. there is no functionality to update the ui or the rest. There is an additional set variable node before “Get Data Table Row Names” that one is not needed if you update the variable when clicking on the button.

Forgot to add, when working with tables you may get to the part where you may want to get the data table dynamically, I’ve made this node structure help file to deal with this issue. Lost couple of days to figure this out so hope it helps. (You will know what is this for when you get the issue :slight_smile: ) I mean when you have multiple tables of the same type and you want to swap them for example. The “Get Data Table Row” node will not work if you want to pass it a Data Table as a variable.

3 Likes

I’ll just add that Getting Row Names as an array is a wee bit more civilised than the toString + toName which I haphazardly suggested.

ok, I am going through your help now, and thank you…one more question the variable you have set up called Row index how is that setup to know what data table it’s linked to? I might see how in-door software how it connects…and I am going to go back and rename the row number starting at 0 1 2…

@dorusoftware @Everynone

Don’t rename - use @dorusoftware approach.

exactly, you don’t need to rename the rows. it works like this, first you get all row names in an array, then you use an index to access a row from the index.

If you get this array with all the rows before populating the UI and you use it to also populate the UI togheter with getting the index, then you are sure that the UI order matches the index order.

I’m not sure that the order of rows in a data table is fixed. Maybe it is. But if is not and it may be random, building UI from the data table then getting the rows name separately again may could show strange results. But I’m not sure how it works actually.

my first example didn’t show a data table, I didn’t had one in the project. Just manually select the data table field to the same data table.

If you don’t mind i am going to keep this open…still figuring it all out but i got this much working … ty

@Everynone @dorusoftware