Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to search for a value in a Column of an straight table?

For example in a straight table and in column1 I have value 1 to 10, i want to get the position (rowno) of value 5. is this possible in qlikview?

I tried using match,pick,fieldvalue,fieldindex nothing worked for me. thanks in advance.

2 Replies
Not applicable
Author

Hi,

I had a similar challenge. The solution I found was to write a VB script triggered then by a button to go through the values of the specific column and search the desired value (the document variable vValue holds the value to be searched). You can save the rowno in a document variable (in my example vRowNo) and use it in other objects.

Several assumptions are to be taken into consideration: the table has one dimension, the first expresion contains the values  (1 to 10 in your example) and the table is ordered by this first expression, so that the macro will return the first row where specific value was found.

Code is this:

sub GetRow

set vChart=ActiveDocument.GetSheetObject("CH10") 'here write your chart ID

recno=vChart.GetRowCount-1

for i=1 to recno

     if vChart.GetCell(i,1).text=ActiveDocument.Variables("vValue").GetContent.string

     then

           ActiveDocument.Variables("vRowNo").SetContent i,true

           exit for

     end if

next

end sub

Let me know if this works for you. And if meanwhile you found other solution, I would be very interested to learn ...

Regards,

Carmen

tresesco
MVP
MVP

May be rowno() could help?