1 Reply Latest reply on Apr 20, 2007 5:28 PM by Pete Muir

    entity-query / restrictions

    Dennis M Pettersson Newbie

      I have been pulling my hair for a day trying to define a query properly in components.xml

      In addition to some columns I restrict using an example object, there is a date column I sometimes have to test if it is null, depending on how a checkbox is set.

      To clarify, I have a date column to define when the object is closed.
      In my search page I want the user to check a checkbox to select "Show closed object" if they want to include closed objects, i.e. objects with a closed_date that is not null.

      So, if the checkbox is not checked the query should contain
      closed_date is null
      and if the checkbox is checked, it should not (to include all rows).

      Any ideas how to define a proper <fwk:restriction> for this?

        • 1. Re: entity-query / restrictions
          Pete Muir Master

          I would do this using your example object

          public class ExampleFoo extends Foo {
           private boolean showClosedObject;
           // getters and setters
          
           public Date getDate() {
           if (showClosedObject) {
           return super.getDate();
           } else {
           return null;
           }
          }


          then, your restriction will only be applied if your checkbox is checked. The restriction could just be closedDate < Now()