On 08/05/2013 14:22, Alexis EidelMan wrote:
> I'm stuck on the following issue.
> I want to know a two step link person when the intermediate one had been
> removed.
>
> I mean in case of grandfather, which is a two step link father.father,
> How can access him if he still alive but the father is no more in the
> database.
> Obviously, there is no solution except create a one step link
> "grandfather" if the father is no more in database. But as it's very
> ad-hoc, I'm lookinf for an other solution which could prevent me to have
> 4 more variables and 8 more if I want an other generation (3-step link)
> + it's demand many lines in yaml.
Yes, it is ugly, but it still seems like the best solution with the
current version.
> The case of grandfathers may be easier as it is two many2one link. I
> also want to know grandchildren.
Depending on what you want to do with the grand children, having a
direct link might be the only option at all (dead parents or not),
because you cannot combine several levels of one2many and aggregate at
that point: you need to aggregate at each level. For example, to compute
the average age of grand children, you would have to do something like:
children.sum(children.sum(age)) / children.sum(children.count())
This is somewhat ugly but should work. I fear some operations will be
harder (or even impossible) to translate to a "two step" aggregation
like this.
> According to me, the lonely other option is to keep the father in a
> different entity when removed. It was suggested by Gaetan in an other
> topic.
Well, this seems like even more work/trouble than the multiple-link
approach. It should be possible to use this method, but that will need a
lot (more) code.
The best solution in my opinion requires a new feature in liam2: support
for some kind of global filter that can be easily applied to all (or a
subset of) (sub)processes.
If that feature was present (feel free to implement it ;-)), you would
simply have a dead field and not actually remove the dead, but rather
filter them out for most processes. Of course, you can do this already
(by manually adding the filter everywhere) but it would be error-prone,
inefficient and would massively clutter your model.
Hope it helps,
Gaetan
----------------------------------------------------------------------------
Disclaimer: please see "
www.plan.be/disclaimer.html"
Please consider your environmental responsibility before printing this email
----------------------------------------------------------------------------