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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to get the field value of a field from a row of InfoTable

ptc-1849353
5-Regular Member

How to get the field value of a field from a row of InfoTable

Hi,
I have a InfoTable with 4 fields in it. There are 3 rows in my InfoTable. I want to get the value of 1st field of second row.
I am able to get the second row now out of this row i want get 1st field value and feed it to some LED widget.

Please let me know if it is possible.

Thanks in advance!!

Regards,
Mohammed

2 REPLIES 2
adam11
5-Regular Member
(To:ptc-1849353)

Mohammed,

You can access the first field's value using dot notation. For example: result = myInfoTable[1].fieldName


I assume you're guaranteeing the order in which entries come back by sorting or similar? Otherwise, how do you know you'll always want the second row?


– Adam



<p>To follow up on what Adam wrote:<p></p><div><p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Usually there

is no guarantee what order columns/fields are in.<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">So it is best

to refer to it directly<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Like

infotablevar.rows.FieldName<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Else<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Otherwise,

you can treat the infotable as a json object...<br>

for (var el in infotable.rows) {<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif"> 

  console.log("Element name: " + el + ", element

value:" + infotable[el] + ", element type: " +

typeof(infotable[el]));<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">}<o:p></o:p></span></p></div></p>

Top Tags