Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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
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.