Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Is dual ok with a fair number of number of rows

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

Tags (4)
3 Replies
MVP
MVP

Re: Is dual ok with a fair number of number of rows

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.

Highlighted
MVP
MVP

Re: Is dual ok with a fair number of number of rows

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/

Not applicable

Re: Is dual ok with a fair number of number of rows

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 Steve Dark  to point that out!

Community Browser