Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Removing 'subfields' from the result of GetCurrentSelections()

Hi,

I have a long list of fields that the user can filter on.

I need to expose the list of items with current selections, but the list must exclude 6 specific fields (exclusions are date fields: {Year,Quarter,Month,Week}, a field that determines which visualization is displayed in the graph, and a frozen field that's hidden from view for most users).

Due to our server implementation, I can't use macros.

With RegEx this would be a breeze, but I don't see that option, meanwhile trying to do this with string functions is cumbersome and results in crazy formula bloat, since the removals are being done sequentially, not in parallel.

What are my options / what am I missing?

Labels (3)
1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Understand. How about: 

=concat(
  if( not Match(
    SubField(
      SubField(GetCurrentSelections('|', ':', ',', 1000)
        ,'|'
        ,ValueLoop(1,SubStringCount(GetCurrentSelections('|', ':', ',', 1000),'|')+1)
      )
      ,':',1)
,'Year', 'Quarter', 'Month', 'Week')  // Excluded fields
      ,SubField(GetCurrentSelections('|', ':', ',', 1000)
        ,'|'
        ,ValueLoop(1,SubStringCount(GetCurrentSelections('|', ':', ',', 1000),'|')+1)
      )
    , null() // An Excluded field
  ) // End of if()
,chr(10)) // Concat separator

Sorry if the indentation is off. I have difficulty getting that right in this web editor.  

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

4 Replies
Highlighted
MVP & Luminary
MVP & Luminary

How about just marking the fields as hidden?

Tag Fields Year,Quarter,Month,Week with '$hidden';

-Rob

 

Highlighted
Creator
Creator

@rwunderlich Apologies for the delay. 

To the best of my understanding using tags configures fields at script level, thus globally at the front-end. 

The date fields are fundamental to the app and, in general, their selections should be exposed. I'm dealing with one specific graph where I show 'selections as a % of period total'. All this means is that if Month=July and Fruit=Apple then the calculation is:

count(distinct {$} ID) / count(distinct {<Fruit="*">}  ID) 

Except there are many (~20) selectable fields, not just Fruit (above is for conceptual purposes only; actual calc uses {1 < [DateFld]=$::[DateFld]>} in the denominator) . This is all good and dandy, until the users lose track of which fields they made selections in 🙂 .  To address this, I've been requested to provide an in-graph text blurb listing all the fields in which active selections exist (though not necessarily the selections themselves). Since selectable time fields (of which I have 4: year, quarter, month, week) are visible on the x-axis and don't play into the % calculation, they need to be excluded from said blurb. For all other purposes I want to keep date selections visible. 

Highlighted
MVP & Luminary
MVP & Luminary

Understand. How about: 

=concat(
  if( not Match(
    SubField(
      SubField(GetCurrentSelections('|', ':', ',', 1000)
        ,'|'
        ,ValueLoop(1,SubStringCount(GetCurrentSelections('|', ':', ',', 1000),'|')+1)
      )
      ,':',1)
,'Year', 'Quarter', 'Month', 'Week')  // Excluded fields
      ,SubField(GetCurrentSelections('|', ':', ',', 1000)
        ,'|'
        ,ValueLoop(1,SubStringCount(GetCurrentSelections('|', ':', ',', 1000),'|')+1)
      )
    , null() // An Excluded field
  ) // End of if()
,chr(10)) // Concat separator

Sorry if the indentation is off. I have difficulty getting that right in this web editor.  

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

Highlighted
Creator
Creator

@rwunderlich  Brilliant! I could hug you!!! ...but seeing as we're in the midst of the COVID-19 crisis, I'll just go and educate myself on the ValueLoop function 🙂