Jasper / foundset / conditional relateds

Suppose there is a list of students in Servoy, existing as a foundset.

If I have a Jasper Report, I can print the list of student names by passing the student foundset, e.g., for three listed students,

  1. John Smith
  2. Rudy Jones
  3. Debby Lowell

Some of these students currently are enrolled in classes (services). Suppose I would like one row for each student-service combination valid within a date range. If two of the three students have services within the date range, I’m guessing that I could search for all valid services, then pass to Jasper a services foundset, e.g.,

  1. John Smith taking Dutch
  2. John Smith taking English
  3. John Smith taking PE
  4. Rudy Jones taking Math

But what if one of the students (Debby Lowell) hasn’t any valid services within the date range, but I still want her listed, e.g.,

  1. John Smith taking Dutch
  2. John Smith taking English
  3. John Smith taking PE
  4. Rudy Jones taking Math
  5. Debby Lowell (no services in period)

How do I let the Jasper report know to include Debby, and any other students in the original list that don’t have services within the date range?

Thank you,
Don

Add a field to the foundset that indicates whether or not the student met the criteria. Pass the foundset to Jasper Reports, and use scripting (Groovy or Javascript) to read the ‘criteria met’ field to emit the text desired.

Or, you could pass the unadulterated foundset to Jasper Reports and use scripting to determine whether or not the criteria was met. Keep in mind that the criteria processing would be done each time the report is generated, and, if the foundset is large, it may impact the report’s response time.

I hope this helps!