3 Replies Latest reply: Dec 4, 2013 4:30 AM by Thomas Schmutz RSS

    Is dual ok with a fair number of number of rows

    Bill Markham

      Hi

       

      I am getting really into the Dual() function and am thinking of expanding my use of it.

       

      Are there any things to beware of with regard to the number of rows ?

       

      I am not talking a huge number of rows, a few thousand maybe a few tens of thousands.

       

       

      Best Regards,     Bill

        • Re: Is dual ok with a fair number of number of rows
          Stefan Wühl

          What kind of concerns do you have?

           

          Remember that dual format is standard in QV, so you might better ask, when you should not use a dual value.

          http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual

           

          P.S. And I believe what is more important than the number of rows is the number of distinct values in that dual format field.

          • Re: Is dual ok with a fair number of number of rows
            Steve Dark

            Hi Bill,

             

            The biggest gotcha you have with dual is that only unique values on the numeric side are kept.  If you have two text representations of the same number only one will be shown.  This can take a while to figure out the first time it happens to you!

             

            To illustrate, if you load the following statement and create a listbox you will find only three values in the listbox:

             

            LOAD

                 dual(Text, Number) as MyDual

            INLINE [

            Text,Number

            A,1

            B,2,

            C,2

            D,4

            ];

             

            Whilst this isn't necessarily a problem just because you have more values going into your dual, the more values you have the more chance you have of hitting a dupe.

             

            Personally I like duals and think you should use them wherever you can.

             

            Steve

             

            http://www.quickintelligence.co.uk/qlikview-blog/

              • Re: Is dual ok with a fair number of number of rows
                Thomas Schmutz

                Steve Dark schrieb:

                ...

                 

                The biggest gotcha you have with dual is that only unique values on the numeric side are kept.  If you have two text representations of the same number only one will be shown.  This can take a while to figure out the first time it happens to you!

                ...

                 

                It just took me a whole day to understand why a leading zero out of a SAP extract couldn't be removed...

                 

                Script:

                [AUSP]:

                Load

                    [ATINN] as [ATINN],

                    [OBJEK] as [OBJEK],

                    [ATWRT] as [ATWRT],

                    [ATFLV] as [ATFLV],

                    if(len(trim([ATWRT]))=0, [ATFLV], [ATWRT])  as [ZWERT]

                from $(vQVD)AUSP.qvd(qvd)

                ;

                 

                Result:

                StraightTable.jpg

                Sort order is in both tables 'Load order'.

                 

                Field tags:

                Field_tags.jpg

                 

                Conclusion:

                ...

                 

                If you have two text representations of the same number only one [the first in Load order] will be shown.

                This can take a while to figure out the first time it happens to you!

                 

                ...

                 

                Thanks a lot stevedark  to point that out!