Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

chhavi376
Contributor II

Search Object

Hi,

I wanted to add an expression in the search object.

PrescriberFlag
P11
P20
P31

I want that i should only be able to search the Prescribers with Flag '1' i.e P1 and P2.

is there any way i can do this?

1 Solution

Accepted Solutions
javier_morales
New Contributor II

Re: Search Object

I don't think there's a way to do that directly in the search object, but you could create an extra field 'PrescriberSearch' in your data model and use that extra field in the seach object instead the original 'Prescriber' one:

test:

LOAD

  *,

  if(Flag = 1, Prescriber, Null()) as PrescriberSearch

;

LOAD * Inline [

  Prescriber, Flag

  P1, 1

  P2, 0

  P3, 1

];

View solution in original post

9 Replies

Re: Search Object

Hi,

You can write the If statements in script and create that flag, like

Load  if(Prescriber = P1 and Prescriber ='P2,1,0) as Flag

From xyx;

Then you can create a listbox of Flag field and make a selection.

Regards,

Kaushik Solanki

Re: Search Object

This blog has details on the expression search  The Expression Search which you can use on a listbox for Prescriber.

=Flag=1 should work in your case though you may need to use something like  =Count(If(Flag=1, Prescriber))


These expressions will work in both the listbox search and the search object.

javier_morales
New Contributor II

Re: Search Object

I don't think there's a way to do that directly in the search object, but you could create an extra field 'PrescriberSearch' in your data model and use that extra field in the seach object instead the original 'Prescriber' one:

test:

LOAD

  *,

  if(Flag = 1, Prescriber, Null()) as PrescriberSearch

;

LOAD * Inline [

  Prescriber, Flag

  P1, 1

  P2, 0

  P3, 1

];

View solution in original post

chhavi376
Contributor II

Re: Search Object

Hi Colin,

Actually i am unable to put any expressions in the search object.

and i was looking for a way except adding it in the script.

Re: Search Object

The expressions work fine in the front-end for me.

Searching on    =Count(if(Flag=1, Prescriber))

Returns P1 & P3

search_test.JPG

chhavi376
Contributor II

Re: Search Object

Colin,

You got me wrong.

actually i wanted to add an expression at the backend.

So that if i search 'P2', it does not display in the search list at all.

the end users don't want to search these flagged prescribers in the search object, but wants to see their data in the chart/table.

chhavi376
Contributor II

Re: Search Object

Javier,

This works.

But let me know if you have some other way, except adding in the script.

Thanks

chhavi376
Contributor II

Re: Search Object

Kaushik,

This will be very cumbersome if we have a large number of Prescribers in the list.

javier_morales
New Contributor II

Re: Search Object

I only know of two ways of accomplishing such behavior.

One is the way I described in my previous post and the other is unchecking the "Include Excluded Values" checkbox in the Presentation tab of the search object properties, filtering by Flag=1 in your document and using set analysis in your chart/table to bypass such filter. But doing so will prevent your users from searching prescribers excluded by other filters in your document so I would advise against it.