<?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 How to find Column(Field) index in a Table by Macro. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-find-Column-Field-index-in-a-Table-by-Macro/m-p/548396#M1148141</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I am new to QlikView development and looking for help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am loading a table from LOAD script from DB. I have a Mecro to perform some business logic and generate XLS. In this mecro, I need to find out the column index of a table. The input is the Column name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex. signature of the method function getColumnIdxByColumnName(colName) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; set staticTbl = ActiveDocument.GetSheetObject("STATIC_DATA")&lt;BR /&gt;&lt;BR /&gt; colCount = staticTbl.GetColumnCount&lt;BR /&gt;&lt;BR /&gt; rowCount = staticTbl.GetRowCount &lt;BR /&gt; set staticCellMatrix = staticTbl.GetCells2(0,0,colCount, rowCount)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For row = 1 To rowCount - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if staticCellMatrix(row)(inputTypeColIdx).Text = inputValue then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookupCid = staticCellMatrix(row)(outputTypeColIdx).Text&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//NOTE:In the above code, inputTypeColIdx and outputTypeColIdx needs to be determinded based on the Column Name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if I am not able to clarify my problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your time spend on reading this post. Any help is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jul 2013 06:09:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-07-08T06:09:19Z</dc:date>
    <item>
      <title>How to find Column(Field) index in a Table by Macro.</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-find-Column-Field-index-in-a-Table-by-Macro/m-p/548396#M1148141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I am new to QlikView development and looking for help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am loading a table from LOAD script from DB. I have a Mecro to perform some business logic and generate XLS. In this mecro, I need to find out the column index of a table. The input is the Column name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex. signature of the method function getColumnIdxByColumnName(colName) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; set staticTbl = ActiveDocument.GetSheetObject("STATIC_DATA")&lt;BR /&gt;&lt;BR /&gt; colCount = staticTbl.GetColumnCount&lt;BR /&gt;&lt;BR /&gt; rowCount = staticTbl.GetRowCount &lt;BR /&gt; set staticCellMatrix = staticTbl.GetCells2(0,0,colCount, rowCount)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For row = 1 To rowCount - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if staticCellMatrix(row)(inputTypeColIdx).Text = inputValue then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookupCid = staticCellMatrix(row)(outputTypeColIdx).Text&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;&lt;P&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//NOTE:In the above code, inputTypeColIdx and outputTypeColIdx needs to be determinded based on the Column Name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if I am not able to clarify my problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your time spend on reading this post. Any help is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Nitin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 06:09:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-find-Column-Field-index-in-a-Table-by-Macro/m-p/548396#M1148141</guid>
      <dc:creator />
      <dc:date>2013-07-08T06:09:19Z</dc:date>
    </item>
  </channel>
</rss>

