Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Fields with selections

Hi,

I have a list of field 'Field1', 'Field2', 'Field3', 'Field4', 'Field5'.

I want to compare this list of fields to current selections in order to generate an output with fields present in my list  in which a selection is currently made.

Does anyone would have an idea to achieve this ?

5 Replies

Re: Fields with selections

I'm not sure I understand what you're after.

If you want a dynamic table with expressions that can be selected from a separate list, have a look at the following example.

Peter

Re: Fields with selections

I don't understand why you can't use a Current Selections Box object. But if you want an alternative have a look at the attached example.


talk is cheap, supply exceeds demand
Not applicable

Re: Fields with selections

Hi,

Thank you for your response.

Here are more details on my problem : I have a master calendar with about 100 fields.

In a table, i have to display the price for the current month, the price for the next month and the price for the previous month.

My table must be independant from selections on a week, a commercial event, a particular day.

I currently create dynamically a set analysis with all the fields of my calendar except the month, but in order to ameliorate my formula I would like to have only the calendar fields present in active selections.

Re: Re: Fields with selections

So, If I understand you correctly you want a string that's a list of the fields in which selections are made?

Well, one way is to create a variable per field that returns the field name if there are selections in the field. Then concatenate all those variables into one string. The variables can be generated in the script:

SET _vFList ='';

FOR i = 0 to NoOfTables()-1;

LET vTable = TableName($(i));

FOR j = 0 to NoOfFields('$(vTable)')-1;

  vField=FieldName($(j),'$(vTable)');

  vVarName=replace('$(vField)',' ','_');

  SET _v$(vVarName) = =if(getselectedcount([$(vField)]),'$(vField),');

  SET _vFList = $(_vFList) & _v$(vVarName);

NEXT j;

NEXT i;

LET _vFList = right('$(_vFList)',len('$(_vFList)')-1 );

The last variable _vFList should return the list of fields when you dollar-expand it in a sheet object: $(_vFList). See attached example.

There may be an easier way, but I haven't found it yet. Maybe a real pro knows how to do this more efficiently.


talk is cheap, supply exceeds demand
dvasseur
Contributor II

Re: Fields with selections

Hi,

I had the same issue and could find a good solution. So I ended in listing all my fields (automatically through variables of course ;-) ) and, to my surprise, the performance was still very good, event with 100 fields.

But I'd love to have a proper answer on this too !

Regards,

David

Community Browser