2 Replies Latest reply on Dec 5, 2014 9:56 AM by paic RSS
    mohammedmuz Explorer

    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

      • How to get the field value of a field from a row of InfoTable
        adam Creator

        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



        • How to get the field value of a field from a row of InfoTable
          paic Collaborator

          <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[i].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[i]) {<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>