Page 1 of 1

Another subform filtering

Posted: Wed Nov 17, 2021 11:43 am
by klasyc
Hello,

I am making a lunch reservation system. Currently I have two tables: restaurant (restaurant_id, restaurant_name, ...) and meal (meal_id, meal_name, meal_date, restaurant_id, ...).

Now I want to make a form where the administrator can populate the meal menu for each restaurant. First I want to select the restaurant_id and meal_date and then display filtered content of the meal table as a subform where I can quickly add a few meals and save all changes at one time.

I have already discovered that a subform cannot be refreshed alone (which I need to apply the filters). Therefore I decided to use iFrame. The main form is a launch form which contains only the filtering components and on button press it refreshes the iFrame. The iFrame contains another launch form which contains the subform. Now the problem is that the subform wants a foreign key, but I want to filter the subform using hash cookies set by the main form and I cannot leave the foreign key field blank.

What is the preferred way of accomplishing the task stated above? Any help will be appriciated.

Thank you for help
Klasyc

Re: Another subform filtering

Posted: Wed Nov 17, 2021 1:24 pm
by kev1n
Hi,

A subform is refreshed after saving a form. So the easiest way is porbably to refresh/reload the form after entering the restaurant and date.
This can also be done automatically with nuSaveAction()

Re: Another subform filtering

Posted: Wed Nov 17, 2021 1:46 pm
by klasyc
But the main form is not currently connected with any database table, so that it cannot be saved :( Of course I could put the subform to the restaurant edit form, but I actually don't want to edit the restaurant and also the restaurant table does not have the fields for date. Or maybe my database design is bad and I should have a third table - menu (menu_id, restaurant_id, menu_date) and use menu_id as foreign key for the meal table. Now it seems this design would fit nuBuilder better... What do you think?

Re: Another subform filtering

Posted: Wed Nov 17, 2021 7:46 pm
by kev1n
Sure, you can give it a go.