# Default initial sort to a relation

**URL:** <https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158>\
**Category:** Classic Servoy\
**Created:** [November 29, 2004, 6:51pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158 "2004-11-29T18:51:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rene](https://forum.servoy.com/u/Rene)\
**Post date:** [November 29, 2004, 6:51pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/1 "2004-11-29T18:51:45Z")

</div>

Hello Everybody,

Is it possible to add a default initial sort to a relation?

To be more clear:

Tables:  
Hardware  
Calls  
Actions

I have a form containing two tabpannels. The upper one is showing calls related to the hardware, the bottom one is showing actions related to the call

In both tabpanels is a field completiondate and a calculation Completed(1/0) when completiondate has been filled.

I always want open calls or actions to be on top and then the most recent completiondates from top to bottom. so I sort on:

```auto
'Completed asc, completiondate desc'

```

Now when I walk through the records in tabpanel Calls, the actions related to the calls show correctly. But I cant trigger an event when this related found set updates so I can get the sort right.

With Kind Regards Rene

---

<div class="post-metadata">

**Author:** ![bcusick](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bcusick](https://forum.servoy.com/u/bcusick)\
**Post date:** [November 29, 2004, 6:56pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/2 "2004-11-29T18:56:54Z")

</div>

Hi Rene,

Attach a method to the “onShow” event of the child form - that should do it.

Cheers,

Bob Cusick

---

<div class="post-metadata">

**Author:** ![Rene](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rene](https://forum.servoy.com/u/Rene)\
**Post date:** [November 29, 2004, 7:42pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/3 "2004-11-29T19:42:31Z")

</div>

Hello Bob

Yes I did that allready but the form does`t hide it just shows another foundset in the tabpanel.

On first show it triggers the method but when the foundset changes it doesn`t get a trigger to execute.

Rene

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 29, 2004, 8:11pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/4 "2004-11-29T20:11:50Z")

</div>

sort property on a relation will be added in a next release

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [February 15, 2006, 12:43pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/5 "2006-02-15T12:43:59Z")

</div>

It seems that the “initialSort” property of a form is not honored if the form is shown in a (related) tab panel. Could this be fixed/added?

Thanks  
Patrick

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [February 16, 2006, 9:57am UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/6 "2006-02-16T09:57:18Z")

</div>

this is because the related foundset is then alreadyloaded (it is set into the form not loaded by the form)  
An initial sort only works for normal foundsets that the form itself loads.

We are planning to add a intialsort in the Define Relation dialog.

---

<div class="post-metadata">

**Author:** ![Karel\_Broer](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@Karel\_Broer](https://forum.servoy.com/u/Karel_Broer)\
**Post date:** [March 16, 2006, 10:19pm UTC](https://forum.servoy.com/t/default-initial-sort-to-a-relation/3158/7 "2006-03-16T22:19:36Z")

</div>

> jcompagner:  
> We are planning to add a intialsort in the Define Relation dialog.

Great idea!
