Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sangland2
Partner - Creator
Partner - Creator

Macro reading columns incorrectly using ajax client

I use the code below to locate the correct column number (by name) to use in GetCell function.

' get column numbers of interest

  for RowIter = 0 to sObject4.GetRowCount-1   ' traverse rows in table

   if RowIter = 0 then

      for ColIter = 0 to sObject4.GetColumnCount-1

         set colName = sObject4.GetCell(RowIter,ColIter)

        if colName.Text = "Invoice Value" then l_col_value = ColIter end if

      next

   end if

  next

  MsgBox l_col_value

.....

set l_value = sObject4.GetCell(RowIter,l_col_value )

I have been struggling to find a reason why  I get a different result in the designer and with the web browser

This post explained that the a natural sort order of columns in straight tables is necessary to get the same result.

https://community.qlikview.com/thread/62636

Do not drag and drop columns if you want to use macros like this.



1 Reply
marcus_sommer

Had you checked the values of your table (maybe with some selections to don't run through thousands of cells):

for RowIter = 0 to sObject4.GetRowCount-1

      for ColIter = 0 to sObject4.GetColumnCount-1

         msgbox(sObject4.GetCell(RowIter,ColIter).Text)

      next

next

maybe they are different to your expectation.

- Marcus