$object return main Object, not line

Hi,
I have an extra field for lines in the Commander Module. If I make it a computed field and user $object->xxx, I get the properties from the Commande itself, not from the line.
How is is possible to get the properties like rowid from the line?
Thanks

Hi,

should be $object->lines[$i]->rowid

1 Like

Thank you. But what can I use for $i when I use the code in computed value in an extra field?
If I write 1 or 2 I her the value…

Hello,

You really need to explain what you want to achieve, because it’s not clear to me.

The $i is between 0 to count($object->lines)

Hi and thank you.
I add an extrafield in the Module Commande and there I add it for Lines:

Now I want to have the Line ID in this field.

Why:
My EndGoal will be to have a function that read out the value for all shipped items for that line. But the function need the LineID as parameter.

Hope now it is possible to understand?

Hello :slight_smile:

I did some tests to achieve what you are looking for, but in fact it seems impossible without making some changes in /core/class/commonobject.class.php - in version 16.0.3

by adding these two lines you can use this formula to find the id of the line in your cmputed field
“$object->myline->rowid”

Using a hook on printObjectLine, this could be another solution for doing this

Good continuation

2 Likes

Tank you very much for this.