Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
marjan_it
Contributor III

Expression based on multiple select Item and not selected Item

Hi All

I have a filed that is from 1 to 9 like this.

LOAD * INLINE [

    Dimension

    1

    2

    3

    4

    5

    6

    7

    8

    9

];

user can select every number in dimension. if in user selection was 6 and not 9 show A in otherwise show B.

for example if user select (1,2,6,8) show A , and if select (1,2,6,8 and 9) show B.


actually my problem is for select 6 and 9 together. if in select was or was not 6 and 9 the answer should be change.


Message was edited by: marjan bakhtiari

1 Solution

Accepted Solutions
marjan_it
Contributor III

Re: Expression based on multiple select Item and not selected Item

Thanks of  help tamilarasu I can solve my Problem by this

=if(index(GetFieldSelections(Dimension,'',10),'6')>=1 and index(GetFieldSelections(Dimension,'',10),'9')=0,'B','A')

View solution in original post

9 Replies
Partner
Partner

Re: Expression based on multiple select Item

Hi

You can use the expression :

=If(WildMatch(GetFieldSelections(Dimension),1,2,6,8),'A','B')

Frank_Hartmann
Honored Contributor II

Re: Expression based on multiple select Item

try this:

=IF(GetFieldSelections(Dimension,';')='1;2;6;8','A', if(GetFieldSelections(Dimension,';')='1;2;6;8;9','B',))

effinty2112
Honored Contributor

Re: Expression based on multiple select Item

Hi Marjan,

Here's another approach:

=Pick(if(GetSelectedCount(Dimension) >0,sum(Aggr(sum(If(Dimension =9,1,0)), Dimension)),0)+1,'A','B')

Cheers

Andrew

effinty2112
Honored Contributor

Re: Expression based on multiple select Item

Hi Marjan,

Earlier I suggested this:

=Pick(if(GetSelectedCount(Dimension) >0,sum(Aggr(sum(If(Dimension =9,1,0)), Dimension)),0)+1,'A','B')


However the simpler expression:

=Pick(sum(Aggr(sum(If(Dimension =9,1,0)), Dimension))+1,'A','B')


might be what you need. The difference is that in the first one will return 'A' if no selection in Dimension is made, the second will return 'B' if no selection is made. Either might be correct for your purposes. If no selection is made then that means 9 hasn't been selected but you could also say that it hasn't been excluded either.


Selecting all values in a dimension has the same effect on the data model as selecting no values - no records are excluded.


Cheers


Andrew

marjan_it
Contributor III

Re: Expression based on multiple select Item

Thanks for your answer, it is ok but not completely.

my problem is for select 6 and 9 together. if in select was or was not 6 and 9 the answer should be change.

Re: Expression based on multiple select Item

Hi Marjan,

May be this,

=If(GetSelectedCount(Dimension)>0,If(Index(GetFieldSelections(Dimension,'',10),'9')=0,'A','B'))

qlikview979
Valued Contributor

Re: Expression based on multiple select Item

Hi  Nag Bro,

I need help

please check here my requirement, if you want my source files check that link i have attached already.

Loading Different data from multiple folders

Before you posted loading data from different sub folders here(here all fiels fied names are same)

Loading Excel Files from multiple Folders

Here My requirement is

I have one folder  "DATA" in this folder  i have two sub folders like "2016_01_01",2016_01_02", in each sub folder having Same Excel file like "SALES".

in first sub folders Excel fields like

ID,NAME,AGE,SALES

in Second sub folders Excel fields like


ID,NAMES,AGE,SALES



In Two tables one field name is Different.


Here i Want to load Single load statement with two Excels data. With out using( "*" and "&" ) symbols.



This is your old  script loading data from multiple sub folders(all sheets having same fields)

SUB Scanfolder(Root)

For each FileExtension in 'xlsx'

FOR Each FoundFile in FileList(Root &'\*.'& FileExtension)

T1:

LOAD ID,

    NAMES,

    SAL,

    YEARS

FROM

[$(FoundFile)]

(ooxml, embedded labels, table is Sheet1);

  Next FoundFile

NEXT FileExtension

For Each SubDirectory in DirList (Root & '\*' )

Call ScanFolder(SubDirectory)

Next SubDirectory

End Sub

Call ScanFolder('D:\LOADING DATA FROM MULTIPLE FOLDERS') ;

Now my requirement  little bit change all sheets having different  field names, i want load all sheets data to single load statement. with out using "*" symbol and "Rename" also.


Regards

Mahesh

Re: Expression based on multiple select Item

Hi Mahesh,

Did you try the solutions that are posted by others in your post.? Why you want to load the data without using * and alias name.?

marjan_it
Contributor III

Re: Expression based on multiple select Item and not selected Item

Thanks of  help tamilarasu I can solve my Problem by this

=if(index(GetFieldSelections(Dimension,'',10),'6')>=1 and index(GetFieldSelections(Dimension,'',10),'9')=0,'B','A')

View solution in original post