Limits the items returned by sampling every nth item.
||An integer specifying the nth item count used for sampling.
clause limits the number of items returned by the query to a sampled subset taken every n
th 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).
The following example samples every 100th item in the VOC:
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.
© 1997-2019 InterSystems Corporation, Cambridge, MA