Caché MultiValue Query Language (CMQL) Reference
SAMPLED clause
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Limits the items returned by sampling every nth item.
Synopsis
SAMPLED n
Arguments
n An integer specifying the nth item count used for sampling.
Description
The SAMPLED clause limits the number of items returned by the query to a sampled subset taken every nth item. It thus gives a sample of the items that fulfill the query conditions. SAMPLED returns the first item, then the n+1 item, then the (n*2)+1 item, and so forth. If n is 0 or a negative integer, all items are returned. If n is larger than the total number of items, one item is returned: the first item.
When multiple CMQL clauses are specified the clauses may be specified in any order. The order of application of CMQL clauses is as follows: the WITH clause is always applied first. Its results are supplied to the SAMPLED clause (if present), and the results are supplied to the SAMPLE clause (if present).
Examples
The following example samples every 100th item in the VOC:
LIST VOC SAMPLED 100
The VOC in this example contains 479 items. This program lists # (item 1), CREATE.FILE (item 101), IF (item 201), ORDER (item 301), and SP.RESUME (item 401).
The following example lists the first five items in the VOC that fulfill the SAMPLED clause:
LIST VOC SAMPLED 100 SAMPLE 3
This program lists # (item 1), CREATE.FILE (item 101), and IF (item 201).
The following example lists the every third item in the VOC that is specified in the fields list:
LIST VOC 'ASSOC' 'BY.EXP' 'DUMMY' 'ASC' 'ASD' 'ORDER' 'IF' 'SP.LOOK' 'SP.RESUME' SAMPLED 3
It lists three fields sampled in the order listed: ASSOC, ASD, and SP.LOOK. Note that the DUMMY field, which is not found in the VOC, is not used for the sampling count.
See Also