Another subform filtering

Questions related to using nuBuilder Forte.

Another subform filtering

Unread postby klasyc » Wed Nov 17, 2021 8:13 pm

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
klasyc
 
Posts: 5
Joined: Fri Nov 12, 2021 12:55 am
nuBuilder Version: 4.5

Re: Another subform filtering

Unread postby kev1n » Wed Nov 17, 2021 9:54 pm

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()
kev1n
nuBuilder Team
 
Posts: 2135
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Another subform filtering

Unread postby klasyc » Wed Nov 17, 2021 10:16 pm

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?
klasyc
 
Posts: 5
Joined: Fri Nov 12, 2021 12:55 am
nuBuilder Version: 4.5

Re: Another subform filtering

Unread postby kev1n » Thu Nov 18, 2021 4:16 am

Sure, you can give it a go.
kev1n
nuBuilder Team
 
Posts: 2135
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5


Return to General

Who is online

Users browsing this forum: No registered users and 21 guests