cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Get the row index from an infotable?

aseaton
7-Bedrock

Get the row index from an infotable?

How can i retrieve the row index value like [0]? Using this code is have the following:

var infoTable = me.mapLocations;

var values = new Object();

values.Name = NetworkAsset;

var row = infoTable.Find(values);

to get the row object, but i'm having a problem getting the index number from this.

Thanks.

Andy

2 REPLIES 2
vr-6
4-Participant
(To:aseaton)

Hi,

To retrieve row index for the particular value use for loop:

var size = Infotable.getRowCount()

for (var i=0;i<size;i++)

{

     if (Infotable.rows.FIELD == "VALUE")

          break;

}

result = i // Index for the particular value

Your code it's not 100% correct, i variable it's a local variable on the for loop, you won't have it out of the loop. If you wan't you code to work, you should set a variable out of the loop and set it before the break.

Top Tags