# Extrafield - Choose from table

**URL:** <https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298>\
**Category:** Installing my Dolibarr\
**Created:** [January 6, 2018, 7:28am UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298 "2018-01-06T07:28:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mp95](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@mp95](https://www.dolibarr.org/forum/u/mp95)\
**Post date:** [January 6, 2018, 7:28am UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298/1 "2018-01-06T07:28:08Z")

</div>

Hello everybody,

I have added a custom field to my commercial proposals and invoices.  
So far everything worked fine for the beginning with a field of type “Choose from table / Wähle von Tabelle”  
and “socpeople:lastname” as a query string.

Now I need to extend the query so that there are ownly shown those contacts in the selection list which  
belong to the partner who is chosen for the document.  
To get the list that I need in this additional field I would use the following SQL-Statement:

```auto
SELECT llx_socpeople_extrafields.bb_obj, llx_socpeople.town, llx_socpeople.firstname, llx_socpeople.lastname, llx_socpeople.poste 
FROM llx_socpeople, llx_socpeople_extrafields, llx_propal 
WHERE llx_propal.rowid = $ID$ AND llx_socpeople.fk_soc = llx_propal.fk_soc AND llx_socpeople.rowid = llx_socpeople_extrafields.fk_object
```

In the moment I don’t understand how the syntax in the configuration of the additional field works.  
Could somebody explain the syntax with : | :: to me? This would be very nice.  
I was looking for a better documentation of this dolibarr-Syntax but I didn’t find anything.

> Pièces jointes :
> 
> - [2018-01-0608\_25\_44-Angebotsmoduleinstellungen.png](https://www.dolibarr.org/forum/uploads/short-url/qr1EueqpIBgEhQaT5XF7XyNFl1g.png) (42.7 KB)

---

<div class="post-metadata">

**Author:** ![groffjunior](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/groffjunior/32/510_2.png) [@groffjunior](https://www.dolibarr.org/forum/u/groffjunior)\
**Post date:** [June 17, 2020, 4:18pm UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298/2 "2020-06-17T16:18:02Z")

</div>

I need it too, its very hard.

---

<div class="post-metadata">

**Author:** ![jh482002](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@jh482002](https://www.dolibarr.org/forum/u/jh482002)\
**Post date:** [October 1, 2024, 4:39pm UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298/3 "2024-10-01T16:39:56Z")

</div>

I know this is old, but did anyone find a solution? I need to generate an Address from Contacts.

---

<div class="post-metadata">

**Author:** ![DarJP](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/d/9dc877/32.png) [@DarJP](https://www.dolibarr.org/forum/u/DarJP)\
**Post date:** [October 2, 2024, 7:31am UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298/4 "2024-10-02T07:31:43Z")

</div>

I’m not sure if these are as ‘advanced’ as you require, but I have used these to find contact options based on the customer selected for and order/shipment

At Order level:  
socpeople:lastname:rowid::fk\_soc=($SEL$ fk\_soc FROM `llx_commande` where rowid=$ID$)  
At Shipment Level:  
socpeople:lastname:rowid::fk\_soc=($SEL$ fk\_soc FROM `llx_expedition` where rowid=$ID$)

This seems to work for combining fields:  
socpeople:concat(lastname,firstname):rowid::fk\_soc=($SEL$ fk\_soc FROM `llx_expedition` where rowid=$ID$)

---

<div class="post-metadata">

**Author:** ![jh482002](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@jh482002](https://www.dolibarr.org/forum/u/jh482002)\
**Post date:** [October 4, 2024, 5:57pm UTC](https://www.dolibarr.org/forum/t/extrafield-choose-from-table/16298/5 "2024-10-04T17:57:25Z")

</div>

Thanks @DarJP  
I tried your first one for Sales Order with the following error:  
 ![image](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/f/f662c738af8541fd93e2cfe41b0d141bef3da2bc.png)  
Bad string syntax to evaluate (mode 2, found call of a function or method without using the direct name of the function): socpeople:lastname:rowid::fk\_soc=($SEL$ fk\_soc FROM llx\_commande where rowid=$ID$)

Ideas?

Other 2 produced the same error.

Will this provide a String (to be printed on ODT)?

Thanks
