Skip to main content
12-Amethyst
May 25, 2017
Solved

Get the row index from an infotable?

  • May 25, 2017
  • 2 replies
  • 5014 views

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

Best answer by CarlesColl

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.

2 replies

1-Visitor
May 25, 2017

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

1-Visitor
May 26, 2017

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.