9 Replies Latest reply: Sep 6, 2016 3:11 AM by suresh m RSS

    Qliksense CVL DimensionList extension for cyclic group

    suresh m

      Hi ,

       

      Any one use "CVL DimensionList :extension for acheiving cyclic group Please explain the procedure how to use this extension.

       

      i Tried this extension in this way,

      dragen the cvldimension list into visualisation and added 3 dimensions

      then take a bar chart and added dimension as =$(vDimensionList) and 1 expression its throwing invalid Dimension

       

      Please suggest the right way to achieve cyclic group functionality and custom sorting for each dimension used in the dimension list

       

       

      Thanks&Regards

      suresh

        • Re: Qliksense CVL DimensionList extension for cyclic group
          Charlie Hudson

          Hi Suresh,


          You have done everything okay. Please check whether the dimension you have added contains a space or special characters - I believe you may need to enclose the dimension with [ ].

           

          Thanks,

           

          Charlie

          • Re: Qliksense CVL DimensionList extension for cyclic group
            Charlie Hudson

            Hi Suresh,

             

            Please see the attached - is this what you was referring too?

             

            Charlie

              • Re: Qliksense CVL DimensionList extension for cyclic group
                suresh m

                Thank you for providing the attachment, your app also showing invalid Dimension, please check it once and update a new one.

                 

                Regards

                suresh

                  • Re: Qliksense CVL DimensionList extension for cyclic group
                    Charlie Hudson

                    Hi Suresh,

                     

                    Is the error when the application initially loads? Due to the fact there is no initial selection within the drop down list.

                     

                    Once you make a selection does the error go?

                     

                    Charlie

                      • Re: Qliksense CVL DimensionList extension for cyclic group
                        suresh m

                        Hi Charlie,

                         

                        Its Working great now, while using this extension i was facing issue with sorting.Actually am using 9 dimension in list and each dimension have different sort order (Custom Sorting) .

                        When i evaluate dimension $(vDimensionList) it displaying  $(vDimensionList) (same) instead of field name


                        How to achieve this sorting?


                        Regards

                        suresh

                         

                          • Re: Qliksense CVL DimensionList extension for cyclic group
                            Charlie Hudson

                            Hey,

                             

                            Made a quick brutal tweak just to fetch the style in line with Sense (green, white text, padding, bottom border)

                             

                            
                            
                            var _app;
                            define( ["jquery", "qlik"], function ( $, qlik ) {
                             'use strict';
                            _app=qlik.currApp();
                             function createVariable ( name ) {
                              //from 2.1: check if variable exists
                              if ( _app.variable.getByName ) {
                              _app.variable.getByName( name ).then( function () {
                                //variable already exist
                              }, function () {
                                //create variable
                                _app.variable.create( name );
                              } );
                              } else {
                              //create variable - ignore errors
                              _app.variable.create( name );
                              }
                             }
                             return {
                              initialProperties: {
                              version: 1.0,
                              qHyperCubeDef: {
                                qDimensions: [],
                                qMeasures: [],
                                qInitialDataFetch: [{
                                qWidth: 20,
                                qHeight: 1
                                }]
                              }
                              },
                              //property panel
                              definition: {
                              type: "items",
                              component: "accordion",
                              items: {
                                dimensions: {
                                uses: "dimensions",
                                min: 2,
                                max: 20
                                
                                },
                                variable: {
                                type: "items",
                                label: "Variable",
                                items:{
                                  VariableName: {
                                  type: "string",
                                  label: "List Variable Name",
                                  ref: "variable.variablename",
                                  defaultValue: "vDimensionList"
                                  }
                                }
                                
                                },
                                /* measures: {
                                uses: "measures",
                                min: 1,
                                max: 1
                                },
                                sorting: {
                                uses: "sorting"
                                },*/
                                settings: {
                                uses: "settings"
                                }
                              }
                              },
                              snapshot: {
                              canTakeSnapshot: true
                              },
                              paint: function ( $element, layout ) {
                              var divName = layout.qInfo.qId;
                              var self = this, html = '<table width="100%" id="dimensionListTable_' + divName + '">';
                              var dimensions = layout.qHyperCube.qDimensionInfo;
                              
                              
                              var vVariableValue='Test value';
                              var varName=layout.variable.variablename;
                              createVariable(varName);
                              
                              _app.variable.getContent(varName, function(varContent) { 
                                
                                var vCurrentSelected = ''+varContent.qContent.qString;
                                if ( dimensions && dimensions.length > 0 ) {
                                
                                if(vCurrentSelected.trim()=='')
                                {
                                  vCurrentSelected=dimensions[0].qGroupFieldDefs;
                                  //console.info('Setting initial: ' + dimensions[0].qGroupFieldDefs);
                                  selectDimension(dimensions[0].qFallbackTitle, dimensions[0].qGroupFieldDefs, varName, divName);
                                }
                                
                                for(var dim in dimensions) {
                                  var vBGColor=dimensions[dim].qGroupFieldDefs==vCurrentSelected ? '#52CC52' : '#ffffff';
                                  var vTextColor=dimensions[dim].qGroupFieldDefs==vCurrentSelected ? '#ffffff' : '#595959';
                                  
                                  
                                  html += '<tr><td style="border-bottom: 1px solid #dddddd; padding: 5px; background-color: '+ vBGColor +'; color: '+ vTextColor +';" onclick="selectDimension(\'' + dimensions[dim].qFallbackTitle + '\', \'' + dimensions[dim].qGroupFieldDefs + '\', \'' + varName + '\', \'' + divName + '\')">';
                                  html += dimensions[dim].qFallbackTitle;
                                  html += "</td></tr>";
                                  
                                } 
                                }
                                html += "</table>";
                                $element.html( html );
                            
                              } );
                              
                              
                              }
                             };
                            } );
                            function selectDimension(dimText, dimName, varName, divName)
                            {
                             // if the varName is passed, put the dimension into the variable 
                             if(varName)
                              _app.variable.setContent(varName, dimName);
                              
                             // First locate the table, then set each td to a white background, finally filter the tds by dimension text and set to green background  
                             $("#dimensionListTable_"+divName).find("td").css('background-color', '#ffffff').filter(function() {
                              return $(this).text() == dimText;
                             }).css('background-color', '#52CC52');
                             $("#dimensionListTable_"+divName).find("td").css('color', '#595959').filter(function() {
                              return $(this).text() == dimText;
                             }).css('color', '#ffffff');
                            }
                            
                            
                            • Re: Qliksense CVL DimensionList extension for cyclic group
                              Charlie Hudson

                              HI Suresh,

                               

                              Without trying are you able to use a custom sort order Creating a custom sort order - The Qlik Fix! The Qlik Fix! and combine this with an If statement utilising the $(vDimensionList) variable?

                               

                              Charlie

                                • Re: Qliksense CVL DimensionList extension for cyclic group
                                  suresh m

                                  Hi Charlie,

                                   

                                  Thank you for response, Can you elaborate how to achieve this sorting, All the 8 dimensions are in a  CVLDimension List to achieve cyclic group functionality.

                                   

                                  I have BankName& BankRouting need to sort Dynamically on Frequency Descending,

                                  Store, Statement Number,Attempts ---- > Numeric ASC

                                  Payfrequency,AmountBins,ApprovedBins --- > Custom sort using expresion

                                   

                                  Thanks & Regards

                                  suresh