FirstValue - script function

FirstValue() returns the value that was loaded first from the records defined by the expression, sorted by a group by clause.

Note: This function is only available as a script function.

Syntax:  

FirstValue ( expr)

Return data type: dual

Arguments:  

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

Limitations:  

If no text value is found, NULL is returned.

Examples and results:  

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

Example Result  

TeamData:

LOAD * inline [

SalesGroup|Team|Date|Amount

East|Gamma|01/05/2013|20000

East|Gamma|02/05/2013|20000

West|Zeta|01/06/2013|19000

East|Alpha|01/07/2013|25000

East|Delta|01/08/2013|14000

West|Epsilon|01/09/2013|17000

West|Eta|01/10/2013|14000

East|Beta|01/11/2013|20000

West|Theta|01/12/2013|23000

] (delimiter is '|');

 

FirstValue1:

LOAD SalesGroup,FirstValue(Team) as FirstTeamLoaded Resident TeamData Group By SalesGroup;

SalesGroup

East

West

FirstTeamLoaded

Gamma

Zeta

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?