showRecords does not work..

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

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

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

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

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

greg.