Navigating from parent to child via method

Hello everyone,

I’ve joined the ranks!

My name is Miguel and after careful evaluation “some” playing with Servoy and eavesdropping on this forum alot I’ve decided to buy some Servoy licenses and implement a in-house solution in Servoy. For now I’m just learning how to use Servoy developing some simple use cases.

Naturally learning a new tool means - PROBLEMS - ;-)(

Here’s my first one:

2 tables: book and book_details (1-to-M)

I have a tabless panel on the book form where I display related book_details.

The related book_details form is a Table view (locked) with a header displaying labels and a button to create new records and a body part with chapter number, notes and a button to navigate to the book_details form.

The idea is that one is in the book form and presses in a chapter (book_details) button to see (navigate to) the book_detail form.

My problem is that I loose the related book_details set and get the first of all contacts in the book_details table (related or not). Curiously if I only navigate to the book_details list I preserve the found set (book_details).

The code I have on the button is - method gotoBook:

forms.bookDetails.controller.show(forms.book_master.book_to_book_details)

I hope this was clear.

I’ve seen the tutorials, scanned the help file, servoy manuals, this forum and servoy magazine. I found no clue on how to accomplish this basic task!

Please help.

Best ,
mjekl - Miguel

The show function will display a form, but not affect the found set on that form. Look at loadRecords and showRecords.

In any case, here’s what I would do:

If you want to navigate to a particular chapter, then I would put the method in book_details, not in book, and put the button on the row. The method in book_details would load the book_details form.

If you want to just go to all the related book details, though, look at the controller.loadRecords function.

Hope this helps!

Hi Cain,

I think I’m doing as you are describing.

Let me clarify a little:

  • book_form
  • book_details_list
  • book_detail (single chapter)

My method is attached to button on a row (as you describe) in book_details_list that is shown in book_form through a tabless panel.

If I make the method: controller.show()
As expected I get the correct record in book_details_list

What I want is to display that specific chapter in book_detail. So I’ve tried the method:
forms.book_detail.controller.show(forms.book_master.book_to_book_details_list)

But that takes me to the first record in the table (which is non-related and certainly not the one I selected)!

Thanks,
Miguel

But the parameter for show is a FORM, not a relation or a set of records.

You don’t want to just show the form, you want to ‘load’ particular records in that form.

From Servoy Help:

Function show()
Description Shows a form; does not affect the foundset.
Example controller.show();

Does that help?

Yes!

I’ve missread the Developers Reference Guide and have been confusing show() with showRecords() page: 207 - the latter takes an argument.

So I’ve realized that:

  1. forms.book_detail.controller.show(forms.book_master.book_to_book_details_list)

is wrong (but returns without errors all the records in book_details table).

  1. forms.book_detail.controller.show()

is correct but returns all recs in book_details table (not what we want)

  1. forms.book_detail.controller.showRecords(forms.book_master.book_to_book_details_list)
    OR forms.book_detail.controller.show(foundset)

work correctly displaying the foundSet and positioning the controller on the correct record (as selected in the tabless panel)

Thank you for pointing me in the right direction.

Miguel