Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

conditional selection in edit forms

Questions related to using nuBuilder Forte.
Post Reply
capstefano
Posts: 21
Joined: Sat Jan 21, 2023 12:17 am
Has thanked: 19 times
Been thanked: 4 times

conditional selection in edit forms

Unread post by capstefano »

Hello there! I'm trying to create a app to prepare medical recieps.

I want to create a system made to avoid wrong prescription while assisting the operator in the choice for the correct drug or exam.

I have three tabs: one for the prescription category (anti-pain, antibiotics, X-rays etc) with the ID and the name of the category; in another tab I've put the drugs, with the unique ID and the category ID as external key; in the last tab I've got the posology pattern, of course with the unique ID and the drug ID as external key. All relations were made at the database level.

I'm tryin to build a edit form for another table (prescriptions) to be populated with the data from three select object: one for the category, one for the drug and one for the posology, and I'd like to have the objects refreshed with the correct value as a selection is made (obviously in the "category->drug->posology" order).

How can I link the value of a select object to another one's query, and having the successive object ready with the right selection?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: conditional selection in edit forms

Unread post by kev1n »

Hi,

To refresh another select object based on the value of a first select object, you can use the nuRefreshSelectObject() function in the onchange event of the first select object. Then, in the SQL of the second select object, you can write a WHERE clause that references the value of the first select object using #id_of_other_select#.

For example, let's say you have two select objects, select1 and select2. When the value of select1 changes, you want to refresh select2 and show only the options that are related to the selected value in select1.
To to so, add an onchange event to the first select object and call nuRefreshSelectObject('select2');
The SQL of select2 contains a WHERE clause that looks like

Code: Select all

WHERE some_column = '#select1#'
capstefano
Posts: 21
Joined: Sat Jan 21, 2023 12:17 am
Has thanked: 19 times
Been thanked: 4 times

Re: conditional selection in edit forms

Unread post by capstefano »

Thank you very much, kev1n.
I love nubuilder and I'd like to contribute to nubuilder's italian translation, but I can't contact you right now by private message (seems I'm not-so-active in writing in the forum, but it's not laziness, it's just lack of competence ;-))
Feel free to send me the material requiring translation or revision.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: conditional selection in edit forms

Unread post by kev1n »

Thanks for your support! A private message has been sent that includes access to the translation platform.
Post Reply