no, is not an example, i need to print the random ten percent of the products of a warehouse, to make a random physical check of the stock. i have been thinking in two possible solutions: 1. select random() as random, p.productname, ( select count( p.product_id ) from product p where p.warehouse = 'X' ) as counting from m_product p where p.warehouse = 'X' order by random; and then on ireport, in the detail section, print when expression: $V{REPORT_COUNT}.intValue() <= Math.round( $F{counting}.intValue() / 10 ) the limitations of this solution is that I use a subquery to know how many records I will have 2. the second solution I was thinking about is use some variable of ireport to know how many records return the main query, but $V{REPORT_COUNT} can not be used because on each record, its value is value++.