Loading records into a tabpanel

Hello
I have a problem with loading records into a portal. When I use the following code, the records are only loaded into the portal, when the script is triggered two times (here i only show the begining of the select statement; i use four unions and a couple of joins - the select, however, is correct…). With the first attempt, the portal becomes visible, but the records only show with the second triggering. I don’t recall having this problem in earlier servoy versions. Is there a problem with my code? Has anyone seen something similar?
Thanks a lot,
Reto

var query = 'select os.obj_id… ’
var pkdataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturedRows);

if ( pkdataset.getMaxRowIndex() == 0 )
{
plugins.dialogs.showInfoDialog( ‘Message’, ‘No record found’, ‘OK’);
}
else
{
elements.select_lesson.visible = true;
forms.select_lesson_list.controller.loadRecords(pkdataset);
}

first you do a visible (of a portal element?) of the current form.
Thne you are setting a pkset in a completel different form. What is the relation between that form and the current form where the portal is on?

The form I’m doing this from is named “check_in_form”. On this form I have portal named “select_lesson”, in which i want to display the form “select_lesson_list” (with the result of the sql query).

I have the same behavior on other forms with portals…

I hope this answers your question… :?:

you can’t show a form inside a portal. So i think you mean on form check_in_form you have a tabpanel with a form select_lesson_list?

if that above is the case then i need a sample solution that demonstrates this behavior

sorry, of course i meant tabpanel! i’ll try to make a small sample solution…

I wasn’t able to reproduce the behavior in a sample solution. It works perfectly there. I tried with Servoy and with MySQL tables (my solution uses MySQL).
Now I just use the “…loadRecords(pkdataset);” line twice and it works. Not very elegant, but it does the job…

Thanks anyways,
Reto

If you are able to show it to me at sometime then please do

Hi Reto,

Have you tried this by loading the records first and then making the tabpanel visible !?
Just curious if it would work and then may point Johan to a reason why the original method order may cause a problem

if ( pkdataset.getMaxRowIndex() == 0 ) 
{ 
plugins.dialogs.showInfoDialog( 'Message', 'No record found', 'OK'); 
} 
else 
{ 
forms.select_lesson_list.controller.loadRecords(pkdataset); 
elements.select_lesson.visible = true; 
}

[muse]
Using the loadRecords() twice reminds me of the old FileMaker bug where the ‘go to related record command’ would not work sometimes unless you invoked the script step twice !!
[/muse]

Harry