7 Replies Latest reply: Aug 23, 2011 1:38 PM by John Witherspoon RSS

    How not to display a dimension in a chart, when it is null?

    Richard Sheppard

      Hi all,

       

      Have created a "Dynamic report" which allows users to specify which reporting dimensions they want displayed in a report, through the use of variables

       

      PROBLEM: when no selection has been made in "zzUser_Select2", the report displays an error message in the 2nd column

       

      AIM: what changes need to be made to my syntax, in order to return null() or no dimension when no selection has been made?

       

      Current syntax:  =if(isnull($(zzVariable2)),null(),$(zzVariable2))

       

      Kind regards,

       

      Rich

        • Re: dynamic report creation - "isnull()" issue
          Richard Sheppard

          Hi,

           

          Found a quick work around for the above:

           

          " =if(len(zzVariable2)=0,null(),$(zzVariable2)) "

           

          I would now like to not show a column, when there is no dimension being returned (ie dimension =  null().

           

          "Suppress when value is null" (in the dimensions tab) doesn't display any dimensions, when one or more dimensions return a null (ie both disappear, when one displays a null) - is there a work around for this?

           

          Please advise,

           

          Kind regards,

           

          Rich

          • Re: dynamic report creation - "isnull()" issue
            Richard Sheppard

            just realised my error in my original post - syntax should have been

             

            =if(isnull(zzVariable2),null(),$(zzVariable2))

             

            Anyone have any thoughts how to not display a dimension in a chart, when it is null?

              • How not to display a dimension in a chart, when it is null?
                Richard Sheppard

                does anyone have any thoughts as to whether this is possible or not?

                 

                Please advise,

                 

                Kind regards,

                 

                Rich

                  • How not to display a dimension in a chart, when it is null?
                    Kaushik Solanki

                    Hi,

                     

                        If you want to hide the dimension depending upon the condition, then you should use the straight table instead of pivot table.

                     

                        Go to Presentation Click on the Dimension you want to hide and click on Conditional

                     

                        Type condition as

                     

                        =if(isnull(zzVariable2),0,1)

                     

                    Regards,

                    Kaushik Solanki

                      • Re: How not to display a dimension in a chart, when it is null?
                        Richard Sheppard

                        Hi Kaushik,

                         

                        Thanks for your ideas, although think that perhaps the feature that you are talking about is not available in QV v8.5?

                        RptVariables.gif

                        ------------------------------------------------------------------------------------

                         

                        Have created a work around which produces the end result, but perhaps not in the most optimal manner:

                         

                        Using the "GetSelectedCount" function, have created a variable to identify how many "fields" the user has selected (RptColCount).

                         

                        Report has been cloned for as many times as there are reportable columns, with additional calculated dimension added

                         

                        Conditional show has been applied on the various reports, to reflect the number of reportable columns

                         

                        ------------------------------------------------------------------------------------

                         

                        +ve :  Solves my issue
                        -ve :   More than one report needs to be created (ie no "master report")

                         

                        ------------------------------------------------------------------------------------

                         

                        Can anyone expand on this approach, in order to create just the one master report?

                         

                        Any thoughts appreciated,

                         

                        Kind regards,

                         

                        Rich

                          • Re: How not to display a dimension in a chart, when it is null?
                            Toni Kautto

                            QlikView 8.5 is no longer officially support, so please consider upgrading to QV9 or QV10. In general an upgrade from QlikView 8.5 also provides a richer developer experiance with more features.

                            • How not to display a dimension in a chart, when it is null?
                              John Witherspoon

                              I haven't read carefully or looked at your examples, but on the surface it looks like you have the same issue that was solved in several different ways in this thread:

                               

                              http://community.qlik.com/thread/33228

                               

                              The solution I use is the dynamic report template I posted, though you can significantly simplify the macro if you're only fiddling with dimensions and not expressions (I think I have an example of that as well if you want it).  If you really want to stick with variables instead, another example further down the page shows hiding dimensions that are based on variables when that variable isn't set to one of the fields.  For that matter, Nicolas Allano posted some hybrid code using macros to actually add and remove dimensions based on the variables similar to how my dynamic report template adds and removes dimensions based on selections in a "Dimension" field.

                               

                              If I'm misunderstanding the problem due to skimming, I apologize, and I can take a closer look.