Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to find Column(Field) index in a Table by Macro.

Hello Community,

I am new to QlikView development and looking for help.

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.

Ex. signature of the method function getColumnIdxByColumnName(colName)

set staticTbl = ActiveDocument.GetSheetObject("STATIC_DATA")

colCount = staticTbl.GetColumnCount

rowCount = staticTbl.GetRowCount
set staticCellMatrix = staticTbl.GetCells2(0,0,colCount, rowCount)     

For row = 1 To rowCount - 1
       if staticCellMatrix(row)(inputTypeColIdx).Text = inputValue then
           lookupCid = staticCellMatrix(row)(outputTypeColIdx).Text
      end if

next

//NOTE:In the above code, inputTypeColIdx and outputTypeColIdx needs to be determinded based on the Column Name.

Please let me know if I am not able to clarify my problem.

I appreciate your time spend on reading this post. Any help is highly appreciated.

thanks

Nitin

0 Replies