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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Infotable column reference as inputParameter

tcoufal
13-Aquamarine

Infotable column reference as inputParameter

Hi Guys,

i need you help once more.

I have a service which takes one input parameter:

propertyName (string)

I query a DataTable and goes through the results like this

var myTable = infotable result from queryDataTableEntries

var tableLength = myTable.rows.length;

for (var x = 0; x < tableLength; x++) {

    y = myTable.rows.propertyName;

}

however this reference does not seem to work. If I dont use reference and place some existing column name then it works.

Is there any special syntax for indirect reference (like for things, Thing[yourThing].property ....)?

Thanks

3 REPLIES 3
tcoufal
13-Aquamarine
(To:tcoufal)

Hi Guys,

JavaScript supports two ways of property accessors:

object.property

object["property"]

So solution to my problem was actually quite easy:

for (var x = 0; x < tableLength; x++) {

    y = myTable.rows[propertyName];

}

Hope that helps someone, but I think that lot of you know that already.

Tomas

qngo
12-Amethyst
(To:tcoufal)

Hi, usually I use myTable instead of myTable.rows. I wonder if JavaScript supports two ways of table accessors or if it's ThingWorx.

tcoufal
13-Aquamarine
(To:qngo)

Hi,

what is the difference exactly?

Announcements


Top Tags