<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Rif.: Get all rows from a table control in LabWindows/CVI</title>
    <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1518136#M52182</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GetTableCellRangeVals worked fine for numeric data. But it gives error of array size of arrTest being too small for string type cells. My code is as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;int iNumRows = 0;&lt;BR /&gt;int iNumCols = 0;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;char *arrTest = NULL&amp;nbsp; ; &lt;BR /&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;GetNumTableRows(gPanelHandle, pnlIPandDB_tblList, &amp;amp;iNumRows);&lt;BR /&gt;GetNumTableColumns(gPanelHandle, pnlIPandDB_tblList, &amp;amp;iNumCols);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;arrTest = calloc (iNumRows * iNumCols, sizeof (char[500])); &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;GetTableCellRangeVals (gPanelHandle, pnlIPandDB_tblList, VAL_TABLE_COLUMN_RANGE (1), &amp;amp;arrTest, VAL_COLUMN_MAJOR);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I am missing something. I will appreciate if someone can help me on this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Apr 2011 00:29:13 GMT</pubDate>
    <dc:creator>Kanu</dc:creator>
    <dc:date>2011-04-09T00:29:13Z</dc:date>
    <item>
      <title>Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1508398#M52033</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table control with one column. What function should I use to retrieve all the rows ? Do I need to iterate row by row and read each row or is it possible to do it in one function ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2011 07:00:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1508398#M52033</guid>
      <dc:creator>Kanu</dc:creator>
      <dc:date>2011-04-01T07:00:26Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1508408#M52034</link>
      <description>&lt;P&gt;Supposing vells in the column have all the same data type, you can retrieve the whole column with a single instruction:&lt;/P&gt;
&lt;P&gt;GetTableCellRangeVals (panel, control, VAL_TABLE_COLUMN_RANGE (1), array, VAL_COLUMN_MAJOR);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The array passed must be large enough to retrieve all data. Alternatively, you may substitute the macro VAL_TABLE_COLUMN_RANGE with the appropriate MakeRect instruction.In case your table was dinamically built, you can obtain the nu,ìmber of rows using GetNumTableRows and dimension your array accordingly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above macro is defined in userint.h together with some other useful macros that can be used to access data in a table.&lt;/P&gt;
&lt;P&gt;There are some precautions to take in case of string values or some cell type (ring, combo box, button...) that are described in the hell for the function.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2011 07:14:38 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1508408#M52034</guid>
      <dc:creator>RobertoBozzolo</dc:creator>
      <dc:date>2011-04-01T07:14:38Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1512868#M52102</link>
      <description>&lt;P&gt;Hi Roberto,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your answer. I appreciate it. I tried using what you suggested, I keep getting out of index error for GetTableCellRangeVals. I guess I am doing something wrong in MakeRect function. Any suggestions for that ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 19:09:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1512868#M52102</guid>
      <dc:creator>Kanu</dc:creator>
      <dc:date>2011-04-05T19:09:03Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513024#M52104</link>
      <description>&lt;P&gt;The first thing that comes to my mind is that row/col indexes on a table are 1-based, differently from array indexes in C which are 0-based. Have you tried using VAL_TABLE_COLUMN_RANGE macro I suggested? You can see how this macro is defined in userint.h.&lt;/P&gt;
&lt;P&gt;The second possibility is thgat the array you are using to retrieve data is too little: if you are allocating it dynamically, could there be some error in calculating its size? Can you try with a smaller area to test your function?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 21:06:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513024#M52104</guid>
      <dc:creator>RobertoBozzolo</dc:creator>
      <dc:date>2011-04-05T21:06:03Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513058#M52105</link>
      <description>&lt;P&gt;Thanks Roberto. VAL_TABLE_COLUMN_RANGE macro works fine. But I still have a doubt why is MakeRect not working. I gave the MakeRect function as MakeRect (1,1,iNumRows,1), where iNumRows are the total number of rows obtained from GetNumTableRows function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 21:56:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513058#M52105</guid>
      <dc:creator>Kanu</dc:creator>
      <dc:date>2011-04-05T21:56:27Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513360#M52107</link>
      <description>&lt;P&gt;As you can see in &lt;A href="http://zone.ni.com/reference/en-XX/help/370051M-01/cvi/uiref/cviusing_rect_and_point_structures/" target="_self" rel="nofollow"&gt;this page&lt;/A&gt;, VAL_TABLE_COLUMN_RANGE is defined as: &lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Monospace"&gt;MakeRect (1, (c), 1, VAL_TO_EDGE)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;that is, you must pass the number of rows in the last parameter of the Rect structure.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2011 04:48:36 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1513360#M52107</guid>
      <dc:creator>RobertoBozzolo</dc:creator>
      <dc:date>2011-04-06T04:48:36Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1518136#M52182</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GetTableCellRangeVals worked fine for numeric data. But it gives error of array size of arrTest being too small for string type cells. My code is as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;int iNumRows = 0;&lt;BR /&gt;int iNumCols = 0;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;char *arrTest = NULL&amp;nbsp; ; &lt;BR /&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;GetNumTableRows(gPanelHandle, pnlIPandDB_tblList, &amp;amp;iNumRows);&lt;BR /&gt;GetNumTableColumns(gPanelHandle, pnlIPandDB_tblList, &amp;amp;iNumCols);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;arrTest = calloc (iNumRows * iNumCols, sizeof (char[500])); &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;EM&gt;GetTableCellRangeVals (gPanelHandle, pnlIPandDB_tblList, VAL_TABLE_COLUMN_RANGE (1), &amp;amp;arrTest, VAL_COLUMN_MAJOR);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I am missing something. I will appreciate if someone can help me on this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2011 00:29:13 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1518136#M52182</guid>
      <dc:creator>Kanu</dc:creator>
      <dc:date>2011-04-09T00:29:13Z</dc:date>
    </item>
    <item>
      <title>Rif.: Get all rows from a table control</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1518150#M52183</link>
      <description>&lt;P&gt;Never mind. Got it. I used char *arrTest[100]&amp;nbsp; and used arrTest in place of array in GetTableCellRangeVals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Kanu&lt;/P&gt;</description>
      <pubDate>Sat, 09 Apr 2011 01:12:43 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Get-all-rows-from-a-table-control/m-p/1518150#M52183</guid>
      <dc:creator>Kanu</dc:creator>
      <dc:date>2011-04-09T01:12:43Z</dc:date>
    </item>
  </channel>
</rss>

