I have 2 tables:
- Patient table
Patient_id
Patient_FirstName <-- Text
Patient_LastName <-- Text
Patient_DOB <-- Date
- Task table
Task_id
Task_Name <-- Varchar(100)
Task_select_patient <-- Select field
Task_pat_DOB <-- Display field
I don't want to save the DOB in the Task table to avoid data duplication. It is the reason why it is a display field.
In the Task Edit form, I would like to retrieve more than the firstname and the lastname but also the DOB (Date of Birth). I perform that by inserting PHP code after Browse :
$lu = nuLookupRecord();
nuSetFormValue('tsk_pat_DOB', $lu->Patient_DOB);
I retrieve the patient DOB perfectly.
But when I reopen the task record, I don't retrieve the DOB. Behind the display field I have the request "Select Patient_DOB from Patient". It doesn't retrieve the DOB of the current patient but the first DOB in the database. I have to use the Hash Cookie but I don't know how to perform that.
Could you please help ?
Many thanks,
Yves
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Retrieve data from another table on load in an edit form Topic is solved
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Retrieve data from another table on load in an edit form
You need to select the DOB of the selected patient like
Code: Select all
SELECT Patient_DOB FROM Patient
WHERE Patient_id = '#id_of_your_lookup_here#'
-
- Posts: 315
- Joined: Sun Mar 14, 2021 8:48 am
- Location: Geneva
- Has thanked: 87 times
- Been thanked: 11 times
Re: Retrieve data from another table on load in an edit form
Hello Kev1n,
I am certainly doing something wrong.
Here is the display field and the related lookup When I open the record, it seems that the sql request behind the display field isn't executed.The display field stays empty.
I am certainly doing something wrong.
Here is the display field and the related lookup When I open the record, it seems that the sql request behind the display field isn't executed.The display field stays empty.
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
-
- Posts: 315
- Joined: Sun Mar 14, 2021 8:48 am
- Location: Geneva
- Has thanked: 87 times
- Been thanked: 11 times