Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Problem with a set expression

Hi,

     I need to populate a chart based on whose y values are Counts as the expression below suggests.

   

    count({1<System={$(vShowSystem)}>} Component).Here System and Components are fields

    vShowSystem is a variable which has a system based on the selection made in the system Listbox.It has only one value.

    I am able to get the value in the Variable but me chart is not showing me any data.

    But,instead of this if I give some defined value.Something like this,

     count({1<System={"ACOM"}>} Component) I am getting the correct values.

    Please let me know the mistake I am commiting

Regards

Navin Gorapalli

1 Solution

Accepted Solutions
erich_shiino
Honored Contributor

Re: Problem with a set expression

Hi,

If you include the expression in the chart:

=$(vShowSystem)

do you get the result you expect?

since vShowSystem can only have one value, maybe  you just need to include the '   '

count({1<System={'$(vShowSystem)'}>} Component)

Or you can write the expression directly on the set analysis:

count({1<System={'$(=only(FIELDwithSELECTION)'}>} Component)

Hope this helps,

Erich

6 Replies

Problem with a set expression

Hi,

   Try this expression

   count({<System= {$(=GetFieldSelections(System))}>}Component)

   Hope this will help you.

   If not then please do  specify how you are getting value in variable.

   Specify the expression used for variable.

Regards,

Kaushik Solanki

Not applicable

Problem with a set expression

  Hi,

      I  am getting the variable value from the selection made on system.

      I have set the variable value to=GetFieldSelections(System).

      I have tried thw way you suggested but with no result.

      Please let me know the right way.

  Regards

  Navin Gorapalli

Problem with a set expression

Hi,

    The problem with GetFieldSelection is that, if you select All values it will show you ALL, instead of list of all values.

 

    Thus it is not working.

    So use below macro to set the variable, with selected field values.

   

Sub GetValues

set val=ActiveDocument.Fields("Year").GetPossibleValues

set Var = ActiveDocument.GetVariable("Variable")

for i=0 to val.Count-1

     if abc = "" then

          abc = val.Item(i).Text

     else

          abc =abc &","&val.Item(i).Text

     End if          

         

next

Var.setcontent abc, true

end sub

and use this expression in your chart.

count({<Year = {$(#Variable)}>}1)

Regards,

Kaushik Solanki

Not applicable

Re: Problem with a set expression

Hi,

     I have followed whatever you have said and I am getting the value in the variable but

     the chart still shows the same thing 'No Data to Display'

     Any other Possible WorkAround.

  Regards

  Navin Gorapalli

erich_shiino
Honored Contributor

Re: Problem with a set expression

Hi,

If you include the expression in the chart:

=$(vShowSystem)

do you get the result you expect?

since vShowSystem can only have one value, maybe  you just need to include the '   '

count({1<System={'$(vShowSystem)'}>} Component)

Or you can write the expression directly on the set analysis:

count({1<System={'$(=only(FIELDwithSELECTION)'}>} Component)

Hope this helps,

Erich

Not applicable

Re: Problem with a set expression

Hi,

 

     Thanks Guys Both of you were really helpful and I was able to sort out the issue.

Regards

Navin Gorapalli