# Adding field to query combo box search form

**URL:** <https://speciforum.org/t/adding-field-to-query-combo-box-search-form/1541>\
**Category:** Get Help\
**Created:** [February 6, 2024, 2:29pm UTC](https://speciforum.org/t/adding-field-to-query-combo-box-search-form/1541 "2024-02-06T14:29:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sorosoro](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sorosoro](https://speciforum.org/u/sorosoro)\
**Post date:** [February 6, 2024, 2:29pm UTC](https://speciforum.org/t/adding-field-to-query-combo-box-search-form/1541/1 "2024-02-06T14:29:05Z")

</div>

Hi,  
Following this post [Edit the Query Combo Box Simple Search Form](https://speciforum.org/t/edit-the-query-combo-box-simple-search-form/1312), I added the geography to the combobox search of the locality table.

The search.views.xml locality element looks like this now:

```auto
        <viewdef type="form"
            name="LocalitySearch"
            class="edu.ku.brc.specify.datamodel.Locality"
            gettable="edu.ku.brc.af.ui.forms.DataGetterForHashMap"
            settable="edu.ku.brc.af.ui.forms.DataSetterForHashMap">           
            <desc><![CDATA[The Locality Search Form]]></desc>
            <enableRules/>            
            <columnDef>p,3dlu,p</columnDef>
            <rowDef>p,2dlu,p,2dlu,p</rowDef>           
            <rows>
                <row>
                    <cell type="label" labelfor="1"/>
                    <cell type="field" id="1" name="LocalityName" isrequired="true" uitype="text"/>
                </row>
                <row>
                    <cell type="label" labelfor="2"/>
                    <cell type="field" id="2" name="geography.FullName" uitype="text"/>
                </row>              
            </rows>
        </viewdef>

```

And the form looks like this:  
 ![4](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/d/de20d2e7593663208f207f8d36c173980134fdf9.jpeg)

The geography field is not active. I thought maybe this field in not searched in the search\_config.xml locality query, so I created an App Resource and loaded the search\_config.xml file into it.

It turns out the geography field is already in the query:

```auto
        <table id="114" tableid="2" name="LocalitySearch" priority="1" color="30, 144, 255">
            <detailView icon="Locality">
                <sql>
                    <![CDATA[SELECT LocalityID, LocalityName,Latitude1,Longitude1,FullName FROM locality LEFT JOIN geography ON geography.geographyid = locality.geographyid WHERE (DisciplineID = DSPLNID) AND (%s)]]>
                </sql>
                <captions>
                    <caption tableid="2" col="LocalityID" visible="false"/>
                    <caption tableid="2" col="LocalityName"/>
                    <caption tableid="2" col="Latitude1"/>
                    <caption tableid="2" col="Longitude1"/>
                    <caption tableid="3" col="FullName"/>
                </captions>
            </detailView>
        </table>

```

But the geography field names in the query look wrong. I changed them to  
geography.GeographyID and geography.FullName, but still the field is not active in the combobox search form.

May it be that Specify 7 does not find the app resource I created with the search\_config.xml? Or is there something wrong in the query?

Thanks.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [February 9, 2024, 7:11pm UTC](https://speciforum.org/t/adding-field-to-query-combo-box-search-form/1541/2 "2024-02-09T19:11:32Z")

</div>

Hi @sorosoro,

> <https://github.com/specify/specify7/issues/1503>
>
> !\[image\](https://user-images.githubusercontent.com/37256050/167699777-d6f26693-a…898-4bd8-b0a6-edc7d8e6d2c2.png)
> 
> db: \`colorado\_paleo\`
> username: \`topdog\_CUpaleo\`

At this time in query combo box search dialogs, Specify 7 cannot search on fields from related tables (in this instances, `geography`, but it affects a number of other tables as well).

You can use the Query Builder button in the bottom right hand side of the dialog to use the full query builder to retrieve records in the meantime until we issue a fix!

I’ve added your post to the issue for future reference. Thank you for providing those snippets of XML and for using other resources on the forum. We appreciate the work and thoughtfulness of your post!

Thank you!

---

<div class="post-metadata">

**Author:** ![sorosoro](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sorosoro](https://speciforum.org/u/sorosoro)\
**Post date:** [February 11, 2024, 7:35am UTC](https://speciforum.org/t/adding-field-to-query-combo-box-search-form/1541/3 "2024-02-11T07:35:26Z")

</div>

Oh, sorry I did not realized there is already an issue opened for this. Good to know. Thanks!
