# Search through relation

**URL:** <https://forum.servoy.com/t/search-through-relation/7320>\
**Category:** Classic Servoy\
**Created:** [April 6, 2007, 12:52pm UTC](https://forum.servoy.com/t/search-through-relation/7320 "2007-04-06T12:52:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DomTom](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@DomTom](https://forum.servoy.com/u/DomTom)\
**Post date:** [April 6, 2007, 12:52pm UTC](https://forum.servoy.com/t/search-through-relation/7320/1 "2007-04-06T12:52:47Z")

</div>

Hello Servoy users,

I mis probably something very simple ?

I have 2 tables : cnt\_contact and com\_communication with relation between the 2 cnt2com. I created a stored calculated field that contains all data on which I would like search : cnt\_dc\_recordview, and com\_dc\_searchall.  
I would like to give user the ability to search on the 2 tables with only one search field.

I use the following method to search on all :

```auto
// start the search
controller.find()

//Take care of positionner field
// calculation summary search field
if (globals.p_text1)
	{
	cnt_dc_recordview = '%' + globals.p_text1 + '%';
	
	//search though relation if records
	if (cnt2com.getSize() > 0)
		{
		controller.newRecord();
		cnt2com.com_dc_searchall = '%' + globals.p_text1 + '%';
		}
	}
	
var found = controller.search();
if (found == 0)
	{
	plugins.dialogs.showWarningDialog('No records found', 'Enter new criterias and try again', 'Yes');
	// reload all records
	controller.loadAllRecords();
	// set focus on p_text1 and select data already in
	elements.f_p_text1.requestFocus();
	elements.f_p_text1.selectAll();
	}

```

But when the relation does not exists between the 2 tables the search always failed.  
Is there a way to tell Servoy to don’t search when relation does not exists ?

I can go around creating dummy com\_communication record for each contact, but I hope there is an other simple solution.

Thanks for your help.

![:?:]( "Question")

DomTom

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [April 6, 2007, 3:31pm UTC](https://forum.servoy.com/t/search-through-relation/7320/2 "2007-04-06T15:31:14Z")

</div>

DomTom,

Servoy 3.5 has support for outer joins in relation which will allow the search you are looking for.  
The first public beta will be available soon.

Rob
