Jump to content
We've recently updated our Privacy Statement, available here ×

dduke

Members
  • Posts

    10
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Posts posted by dduke

  1. you are right about window functions, i'm using postgresql 8.3, that it does not support it (it does support limit), and i can not still migrate to a superior postgresql, so i'm convicted to find other solutions. i have another problem i have to print exactly the 10 percent, even when "where random < .1" is a fine approximation, is not good enough for that specific report, but it's a good idea to take in mind.

    i was hopping to get the value of total records from some place on ireport, but it seems impossible.

    regards

    DDuke

     

  2. 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++.

×
×
  • Create New...