Hi, I’m new to this forum and I would need the help of someone who is more experienced than me in Scriptcase. My problem is as follows:
I have a database with two tables: PATIENTS and VISITS. A patient can undergo multiple visits (each of which represents a record). There are some fields of the visit table that must be copied in the insertion of the new visit, I give an example:
I insert the Patient in the VISITS table:
Rossi Mario - IdPatient 1
FIELD RECORD
IdVisita 1
IdPatient 1 (connected to the PATIENTS table)
DataVisit 10/10/2018
Height 175
Weight 80
Cholesterol 190
Triglycerides 150
Blood glucose 18
Then I insert other patients …
When the patient Rossi (IdPaziente1) comes back to visit, I would need to copy (with the push of a button) some fields of the record inserted last, related to the patient Rossi
Example of the patient Rossi Mario who comes back to visit
FIELD RECORD
IdVisita 5
IdPatient 1 (connected to the PATIENTS table)
DataVisita 09/11/2018
Height 175(field to be copied with the data of the last insertion relative to the patient Rossi IdPaziente 1)
Weight 80 (field to be copied with the data of the last insertion relative to the patient Rossi IdPaziente 1)
Cholesterol 190(field to be copied with the data of the last insertion relative to the patient Rossi IdPaziente 1)
Triglycerides 150(field to be copied with the data of the last insertion relative to the patient Rossi IdPaziente 1)
Blood glucose 18(field to be copied with the data of the last insertion relative to the patient Rossi IdPaziente 1)
The query to be applied should be this:
INSERT INTO visits (Height, Weight, Cholesterol, Triglycerides, Blood Sugar) SELECT Height, Weight, Cholesterol, Triglycerides, Blood Sugar FROM visits WHERE IdPatient = 1;
The action should be as follows:
In the new entry after entering the IdPatient, DataVisita, at the “DATA COPY” button and when the key is pressed, the above query is performed, which must go to take the Patient present in the Archive with the IdPatient = a …
I hope I have been clear in the exhibition and thank you in advance for the help you will be able to give me.