Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » DataObject::get greaterThan

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 638 Views
  • nicanor
    Avatar
    Community Member
    15 Posts

    DataObject::get greaterThan Link to this post

    DataObject::get("PersonPage",
              "TipNr < 1",
              "",
           "",
           "");

    works fine and I get all entries where no number is set and the field is default 0.

    DataObject::get("PersonPage",
              "TipNr > 1",
              "",
           "",
           "");

    and

    DataObject::get("PersonPage",
              "TipNr != 1",
              "",
           "",
           "");

    don't work. I get no result. Is it not possible to use sql "greaterThan" or "isNot" in the Where-clause?

  • nicanor
    Avatar
    Community Member
    15 Posts

    Re: DataObject::get greaterThan Link to this post

    I just saw that

    DataObject::get("PersonPage",
    "TipNr < 1",
    "",
    "",
    "");


    gives back a result but the boolean lower than is not interpreted.

    e.g.

    DataObject::get("PersonPage",
    "TipNr < 5",
    "",
    "",
    "");


    gives back the same result inculded records with tipNr 7,8 ...

    So i thinck it's not possible to use lessthan,greaterthan or isNot with DataObject::get and i have to do it with sqlquery. is it right?

  • nicanor
    Avatar
    Community Member
    15 Posts

    Re: DataObject::get greaterThan Link to this post

    The failure was that i tried a DataObject::get with an object that inherits from a Page. It's not possible to filter Page Objects like above. When the the Object inherits from DataObject evrything works

    extends Page

    vs.

    extends DataObject.

    Solved.

    638 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.