# showRecords does not work..

**URL:** <https://forum.servoy.com/t/showrecords-does-not-work/8828>\
**Category:** Classic Servoy\
**Created:** [March 4, 2008, 5:23pm UTC](https://forum.servoy.com/t/showrecords-does-not-work/8828 "2008-03-04T17:23:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://forum.servoy.com/u/Thunder)\
**Post date:** [March 4, 2008, 5:23pm UTC](https://forum.servoy.com/t/showrecords-does-not-work/8828/1 "2008-03-04T17:23:23Z")

</div>

Dear all

I have the following code which will only work the second (and subsequent) times it is called. First time you run it having started up servoy, it behaves as though there is no related record (there ALWAYS is a related record)… this is my super simple code:

> if (company\_id)  
> {  
> forms.companies.controller.showRecords(actions\_to\_companies)  
> }  
> else  
> {  
> plugins.dialogs.showErrorDialog(‘No company’, ‘There is no company associated with this action’, ‘OK’)  
> }

There is ALWAYS a company\_id on both ends, and the same record will work fine if you do it for a second, third, fourth time etc…

Any help would be appreciated…

Thanks

Bevil

---

<div class="post-metadata">

**Author:** ![Thunder](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Thunder](https://forum.servoy.com/u/Thunder)\
**Post date:** [March 4, 2008, 6:05pm UTC](https://forum.servoy.com/t/showrecords-does-not-work/8828/2 "2008-03-04T18:05:48Z")

</div>

Never mind, figured it out… Had an onload on the target form… my fault…

---

<div class="post-metadata">

**Author:** ![agiletortoise](https://avatars.discourse-cdn.com/v4/letter/a/58956e/32.png) [@agiletortoise](https://forum.servoy.com/u/agiletortoise)\
**Post date:** [March 4, 2008, 6:23pm UTC](https://forum.servoy.com/t/showrecords-does-not-work/8828/3 "2008-03-04T18:23:57Z")

</div>

As a general practice, you might be safer using the following…

```auto
if( databaseManager.hasRecords(actions_to_companies) )
{
   ...
}

```

That will perform a real check on the relation, not trust the data integrity.

greg.
