[Solar-talk] How can i implement ordering on a
_belongsToor_hasMany relationship
Paul M Jones
pmjones at paul-m-jones.com
Wed Feb 20 09:11:38 CST 2008
On Feb 19, 2008, at 23:20 , Kilbride, James P. wrote:
> Paul's suggestion only covers a single way of doing that. If one
> business report requires it be sorted one way and another a different
> way paul's method doesn't allow me to change it,
I can see from your description of the problem, that it would nice if
we could pass params to the get-related-records that would be used for
just that one call. E.g., as you say, to override the default order,
or to add a WHERE clause, or something like that. Not to redefine the
relationship, per se, just to override or merge new params with the
default relation params. I can't say when I'd be able to add that
though. :-(
> unless perhaps I redefine the has many on the fly? I think I can do
> that right?
Probably unwise. :-/
Now, what you *could* do is build several relateds, and name them
appropriately: has many empl_by_id (where the order is by ID), *and*
has many empl_by_name (where the order is by lastname + firstname),
and then fetch the needed relation.
Would that help at all?
-- pmj
More information about the Solar-talk
mailing list