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

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

ptc-1849353
6-Contributor

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

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



paic
12-Amethyst
(To:ptc-1849353)

<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>

Announcements


Top Tags