Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qv_testing
Specialist II

Dual function??

Hi Community,

I am confusing with Dual() function...

Please let me know breif of Dual() function..

what is the purpose???

which type of scenario's using ???

Thanks in advance......

3 Replies
swuehl
MVP

bbi_mba_76
Partner - Specialist

Hi,

you could use it to sort a field, for example.

From the help:

Dual

dual( s , x )

Forced association of an arbitrary string representation s with a given number representation x. In QlikView, when several data items read into one field have different string representations but the same valid number representation, they will all share the first string representation encountered. The dual function is typically used early in the script, before other data is read into the field concerned, in order to create that first string representation, which will be shown in list boxes etc.

Note!
If a dual value is too large to fit in a field object, it will be represented by ## and not truncated with ... like a string.

Example:

load dual ( string,numrep ) as DayOfWeek inline

[ string,numrep

Monday,0

Tuesday,1

Wednesday,2

Thursday,3

Friday,4

Saturday,5

Sunday,6 ];

load Date, weekday(Date) as DayOfWeek from afile.csv;

The script example will generate a field DayOfWeek with the weekdays written in clear text. QlikView will for all purposes regard the field as a numeric field.

datanibbler
Champion

Hi,

I am not quite sure about it myself, haven't used it often yet. - It's explained in the help in any case.

Generally, the DUAL() function assigns both a string-value and a numeric_value to something (e.g. a month can have both the values 'June' and 6) - you need that e.g. to make a set_expression designing the past month for you cannot calculate 'June-1

HTH

Best regards,

DataNibbler