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: 
felcar2013
Partner - Creator III
Partner - Creator III

need dynamic index for current selected field value list

hi

how can i get a dynamic index field  that assigns the current selection a number in asc order?

like this:

load      A,

             B,

              rowno() as Index_Fix

from table.csv;

this would be the fix index. if i filter and get  a subset of rows, the index_fix will display numbers assigned to the corresponding field in the table. Assume i have Num Rows = 100. If i filter in my application, my current selection accounts for,say 23 rows. I want to create a dynamic index, which assigns to the current selection a number in numerical order: 1,2,3,4,5, ... 23.

If i do a second filter of fields and i get as current selection 4 rows, then my dynamic index shall assign to the rows 1,2,3,4

how would this be possible?

thanks for any help

Felipe

21 Replies
swuehl
MVP
MVP

Here is a sample of my latest suggested approach (FirstSortedValue() and show conditions).

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example for another option using one text box to display the texts.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Nice idea, I am a little fan of the valueloop() function.

A more traditional way to do the same might be (and also getting the sorting right):

=concat( aggr(rank(-index_fix) & ' - ' & text ,index_fix), chr(10))

felcar2013
Partner - Creator III
Partner - Creator III
Author

thanks, this is really good, goes in line with the requirement, but it seems it is not practical for a big number of comments, it is working well, it will be very tedius with more than 2,000 comments.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Thanks! Yeah, that's a lot simpler. But index_fix is fixed. I thought the idea was to generate the index based on the number of selections and always starting from 1. Though the sorting then is hopeless of course


talk is cheap, supply exceeds demand
felcar2013
Partner - Creator III
Partner - Creator III
Author

thanks, this is very practical, even though like as what the requirments owner wanted

easy to display 100s of comments

swuehl
MVP
MVP

But index_fix is fixed. I thought the idea was to generate the index based on the number of selections and always starting from 1.

Yes, I think the rank() should take care of that. Attached your modified sample.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Actually, I don't see why you can't use a straight table with some formatting to make it look like a text box. See attached example (the yellow object on the left).


talk is cheap, supply exceeds demand
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Ah, of course. Silly me.


talk is cheap, supply exceeds demand
felcar2013
Partner - Creator III
Partner - Creator III
Author

perfect,  the table is better, it is just that the req owner wanted each comment in a "comments diagram", which is an image (.png)

that was the reason

thanks again