Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

please explain with some example

can anyone explain with an example

1)difference betwen peek and previous function?

2)class and intervalmatch?

2 Replies
Not applicable
Author

peek( fieldname [ , row [ , tablename ] ] )

Returns the contents of the fieldname in the record specified by row in the input table tablename. Data are fetched from the associative QlikView database.

Fieldname must be given as a string (e.g. a quoted literal).

Row must be an integer. 0 denotes the first record, 1 the second and so on. Negative numbers indicate order from the end of the table. -1 denotes the last record read.

If no row is stated, -1 is assumed.

Tablename is a table label without the ending colon. If no tablename is stated, the current table is assumed. If used outside the load statement or referring to another table, the tablename must be included.

Examples:

peek( 'Sales' )
returns the value of Sales in the previous record read ( equivalent to previous(Sales) ).

peek( 'Sales', 2 )
returns the value of Sales from the third record read from the current input table.

peek( 'Sales', -2 )
returns the value of Sales from the second last record read into the current input table.

previous(expression )

Returns the value of expression using data from the previous input record that was not discarded due to a where clause. In the first record of an input table the function will return NULL. The previous function may be nested in order to access records further back. Data are fetched directly from the input source, making it possible to refer also to fields which have not been loaded into QlikView, i.e. even if they have not been stored in its associative database.

Examples:

Load *, Sales / previous(Sales) as Increase from ...;

Load A, previous(previous( A )) as B from ...;

class( expression, interval [ , label [ , offset ]] )

Creates a classification of expressions. The bin width is determined by the number set as interval. The result is shown as a<=x<b, where a and b are the upper and lower limits of the bin. The x can be replaced by an arbitrary string stated in label. 0 is normally the default starting point of the classification. This can be changed by adding an offset.

Examples:

class( var,10 ) with var = 23 returns '20<=x<30'

class( var,5,'value' ) with var = 23 returns '20<= value <25'

class( var,10,'x',5 ) with var = 23 returns '15<=x<25'

IntervalMatch

The IntervalMatch prefix to a Load or Select statement is used for linking discrete numeric values to one or more numeric intervals. There is an advanced application of IntervalMatch involving an extended syntax, that you can read about here. The general syntax is:

intervalmatch (field) (loadstatement | selectstatement )