Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
erichshiino
Partner - Master
Partner - Master

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

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

  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

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

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

erichshiino
Partner - Master
Partner - Master

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
Author

Hi,

 

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

Regards

Navin Gorapalli