Skip to main content

Only - script function

Only() returns a value if there is one and only one possible result from the aggregated data. If the records within each grouped result as defined by the group by clause contains only one value, then that value is returned. Otherwise NULL is returned

Syntax:  

Only ( expr )

Return data type: dual

Only arguments
Argument Description
expr The expression or field containing the data to be measured.

Examples and results:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in our document to see the result.

Temp:

LOAD * inline [

Customer|Product|OrderNumber|UnitSales|CustomerID

Astrida|AA|1|10|1

Astrida|AA|7|18|1

Astrida|BB|4|9|1

Astrida|CC|6|2|1

Betacab|AA|5|4|2

Betacab|BB|2|5|2

Betacab|DD

Canutility|DD|3|8

Canutility|CC

] (delimiter is '|');

 

Only:

LOAD Customer, Only(CustomerID) as MyUniqIDCheck Resident Temp Group By Customer;

 

Example 1 results
Result field (Customer) Result value (MyUniqIDCheck)

Astrida

1

(because only customer Astrida has complete records that include CustomerID.)

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com