Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

In Which situation we will use only()

Hi all,

In Which situation we will use only(),can any one explain with sample scenario.

regards,

6 Replies
Highlighted
Partner
Partner

Re: In Which situation we will use only()

Hi,

When there is one to one relation ship, we can use only function.

In simple word,

Table:

LOAD * Inline [

Dim1, Dim2, Value

A, India, 10

B, USA, 30

];


If we use Dim1 in textbox without any selection , it display null value for both

=Only(Dim1) or Dim1

If We select any value in Dim1, it display the Value in textbox.

If we need to use "Set Analysis", in that case we can use Only() function.

Only({<Dim2 = {'India'}>}Dim1)  display A.


only(expression )

If expression over a number of records, as defined by a group by clause, contains only one numeric value, that value is returned. Else, NULL is returned.

Highlighted

Re: In Which situation we will use only()

Just created an example for Only() today. Have a look here: Only

Highlighted
Partner
Partner

Re: In Which situation we will use only()

Hi Koti,

Help description of Only:

only([{set_expression}][ distinct ] [ total [<fld {, fld}>]] expression)

If expression or field iterated over the chart dimension(s) contain one single value, that value is returned, else NULL is returned. Only can return numeric values as well as text values.

Examples:

only( Sales )

only( Price*Quantity )

only( total Salesman )

HTH- Andy

Highlighted
Creator II
Creator II

Re: In Which situation we will use only()

Still i am in confusion? what is the necessary of use only() in the above example..instead of that if i take dim2 in listbox..then that time also it's working fine..

Highlighted

Re: In Which situation we will use only()

Only() - although it appears to be an extremely straightforward function - is actually a very advanced aggregation function that will save your day more than once. If the use of Only() isn't apparent to you yet, don't worry. You do not need it. You have a solution but no corresponding problem, so just ignore it for the time being.

One of my preferred uses for Only() is whenever I need to apply set analysis on very few values to select a single one. Only() is the only function that let's you pick a single value from a range by simply using set analysis.

Peter

Highlighted
MVP
MVP

Re: In Which situation we will use only()

and a detailed explanation

The Only Function

How to use - Only()