dependent dropdown in a subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Re: dependent dropdown in a subform

Unread postby johan » Sun Oct 10, 2021 5:36 pm

Steven
It's more complicated. Every row has a date - start - end - prison - section - room.
There are only a few sections in every prison. But for every reservation I have to be sure that there are not to much persons in a room and not to much persons in a section.
I need date -start - end - section in my query when populating select or lookup.
Johan
johan
 
Posts: 347
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby steven » Tue Oct 12, 2021 12:12 pm

johan,

Can you show a picture of the whole Edit Form?

How do you record the people and what room they are in?


Steven
steven
 
Posts: 150
Joined: Mon Jun 15, 2009 5:33 pm

Re: dependent dropdown in a subform

Unread postby johan » Tue Oct 12, 2021 4:42 pm

Steven

We want to be able to reservate rooms with this.
The form contains a number of parameters such as first date, last date, ...
With the help of Kev1n I have a procedure to have the rooms filled in the subform. Where there is a conflict (too many people in a section or no free room) it leaves section and room empty in the subform so we can manually add a room.
Below is the query for section in the subform. In this query I need Datum - start -eind from the row of the subform

Code: Select all
SELECT distinct secties.sec_id, secties.sec_name FROM secties
inner join gevangenis  on gevangenis.gev_id = secties.sec_gevangenis
where  secties.sec_gevangenis = '#act_gevangenis#'
AND (coalesce((select sum(act_deelnemers)
    from activiteiten
    inner join reservaties on activiteiten.act_id = reservaties.res_act_id
    where reservaties.res_datum ='#res_datum#' AND  '#res_uur_eind#' > res_uur_start   AND  '#res_uur_start#' < res_uur_eind and res_sectie = '#res_sectie#' ),0)  + '#act_deelnemers#') <= secties.sec_max


Johan
Attachments
Selectie_340.png
Selectie_340.png (106.83 KiB) Viewed 60 times
johan
 
Posts: 347
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby steven » Wed Oct 13, 2021 9:13 am

johan

I'm guessing all the sections are in the sectie table and linked to a record in the gevangenis table.

What is the total number of records in the sectie table?

It would be far easier to create a lookup that has these 2 tables linked,
click on the magnifying glass,
type in the gevangenis (or part of it),
and pick the sectie from there.

You would only need to have a sectie ID stored in the subform table because it is already linked to the gevangenis table.

Like this...

prison.png
prison.png (25.87 KiB) Viewed 49 times


Steven

Steven
steven
 
Posts: 150
Joined: Mon Jun 15, 2009 5:33 pm

Re: dependent dropdown in a subform

Unread postby johan » Thu Oct 14, 2021 2:37 am

Steven
I have 12 sections and I can use #act_gevangenis# (from editform) to link to. 1 activity will never take place in 2 different prisons.

But in an earlier post you wrote
Use a Lookup instead of a Select. This will allow the use of Hash Cookies but only from the main Edit Form (you may need to populate a hidden field before you launch the Lookup.


So even with al lookup I still can't use res_datum, res_uur_start, res_uur_eind to check if the room is available and total persons in section.

Johan
johan
 
Posts: 347
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: dependent dropdown in a subform

Unread postby steven » Fri Oct 15, 2021 10:54 am

johan,

Your original question was

How can I create a dependent dropdown in a subform?
sectie depents on gevangenis.


It seems different from calculating room availability.

I was trying to answer the first question, so I don't really know how to help when you say.

So even with al lookup I still can't use res_datum, res_uur_start, res_uur_eind to check if the room is available and total persons in section.



Steven
steven
 
Posts: 150
Joined: Mon Jun 15, 2009 5:33 pm

Re: dependent dropdown in a subform

Unread postby johan » Fri Oct 15, 2021 1:45 pm

Steven
My first question was indeed how to create depending select because I hoped I could use the other objects of the subform in my SQL.
I understand that what I want is not possible. Maybe a suggestion for a future release?

Johan



Johan
johan
 
Posts: 347
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Previous

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 8 guests

cron