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
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
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:"Verdana",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:"Verdana",sans-serif">So it is best
to refer to it directly<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif">Like
infotablevar.rows.FieldName<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif">Else<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Verdana",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:"Verdana",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:"Verdana",sans-serif">}<o:p></o:p></span></p></div></p>