I am using the following code to go to a company record from a contact record. I am fining from time to time I get a blank result but if I try again the result works ok.
This might be related to an issue (resulted in an invalid selected record index) that is fixed in Servoy 5.1 final - will be released soon.
Try it out, and if the problem persists please create a case in our Support system (a sample solution would be ideal).
As a workaround try something like this and see if it works:
forms.company_frm_main.controller.loadRecords(forms.contact_frm_main.contact_to_company.company_id);
if (forms.company_frm_main.controller.getMaxRecordIndex() > 0) forms.company_frm_main.controller.setSelectedIndex(1);
forms.company_layout_main.controller.show();