links issue

15 views
Skip to first unread message

Alexis EidelMan

unread,
May 17, 2013, 5:30:55 AM5/17/13
to liam...@googlegroups.com
Hi,

I would like to use a long chain of link like that :

test: One2Many.One2Many.Many2One.count()

it doesn't work. The error seems to come from the reading step and occurs only if the entity of the last link is not the same as the entity process.

I've check that if I run first   test_count: Many2One.count()
The no problem with

One2Many.One2Many.test_count

Alexis



Gaëtan de Menten

unread,
May 17, 2013, 5:51:09 AM5/17/13
to liam...@googlegroups.com

On 17/05/2013 11:30, Alexis EidelMan wrote:

> I would like to use a long chain of link like that :
>
> test: One2Many.One2Many.Many2One.count()

This cannot and will never work. You cannot chain One2Many links. You
can only do that with ManyToOne links...

> it doesn't work. The error seems to come from the reading step and
> occurs only if the entity of the last link is not the same as the entity
> process.
>
> I've check that if I run first test_count: Many2One.count()

This cannot work either: the count() method only works on ManyToOne
links, only on OneToMany...

Gaetan




----------------------------------------------------------------------------

Disclaimer: please see "www.plan.be/disclaimer.html"

Please consider your environmental responsibility before printing this email

----------------------------------------------------------------------------

Alexis EidelMan

unread,
May 17, 2013, 6:06:14 AM5/17/13
to liam...@googlegroups.com, g...@plan.be
Obviously, I just swap each link class to the other one in my email. Really sorry about that.
For now, I prefer doing mistakes in email rather than doing mistakes in Liam2, but it wasn't very clever... 
I re-write it.


I would like to use a long chain of link like that :

test: Many2One.Many2One.One2Many.count()

it doesn't work. The error seems to come from the reading step and occurs only if the entity of the last link is not the same as the entity process.

I've check that if I run first   test_count: One2Many.count()
The no problem with

Many2One.Many2One.test_count

Gaëtan de Menten

unread,
May 17, 2013, 10:01:08 AM5/17/13
to liam...@googlegroups.com

On 17/05/2013 12:06, Alexis EidelMan wrote:

> I would like to use a long chain of link like that :
>
> test: Many2One.Many2One.One2Many.count()
>
> it doesn't work. The error seems to come from the reading step and
> occurs only if the entity of the last link is not the same as the entity
> process.
>
> I've check that if I run first test_count: One2Many.count()
> The no problem with
>
> Many2One.Many2One.test_count

This is a known (to me) limitation: the syntax Many2One.XXX only works
for simple variables or Many2One links. This is not trivial to fix and
would only give a very limited benefit given there is an easy
workaround. This should work:

Many2One.Many2One.get(One2Many.count())

PS: a patch for the documentation would be welcome ;-)

Hope it helps,

Alexis EidelMan

unread,
May 17, 2013, 12:08:55 PM5/17/13
to liam...@googlegroups.com, g...@plan.be
 This should work:

Many2One.Many2One.get(One2Many.count())


I'm afraid it doesn't in all cases.

Gaëtan de Menten

unread,
May 21, 2013, 2:05:14 AM5/21/13
to liam...@googlegroups.com
Well, I cannot help you if you do not give me more details: the exact
code you used and the error message (in error.log) is a minimum. A
minimal test case reproducing the error (preferably based on the demo
data, so that you do not need to send me any data file) is better.

Alexis EidelMan

unread,
May 26, 2013, 9:21:49 AM5/26/13
to liam...@googlegroups.com, g...@plan.be
Sorry, I didn't realize how confusing my email could have been.
Here is a version of functonal/simulation.yml which produces an error.
As you need more than two entities, I create a mirro entity. You have to run the attached import file to have it.
import.yml
simulation.yml

Gaëtan de Menten

unread,
May 28, 2013, 7:19:25 AM5/28/13
to liam...@googlegroups.com

On 26/05/2013 15:21, Alexis EidelMan wrote:
> Sorry, I didn't realize how confusing my email could have been.
> Here is a version of functonal/simulation.yml which produces an error.
> As you need more than two entities, I create a mirro entity. You have to
> run the attached import file to have it.

Ah! A link spanning more than 3 *different* entities. That is the key of
the problem. Thanks for the test case. I fixed the problem in the
development version (upcoming 0.7).
Reply all
Reply to author
Forward
0 new messages