If you're saying the Patient Number is identical to the auto-entered serial number, I don't see any advantage to having the same data in two different fields of the same table. Simply use the auto-entered serial ID for whatever purpose you need. Make sure it cannot be modified by the user (even you) however because this would break any relationships depending on this field.
Each patient would, I'm assuming, have only one record, with records in child tables for anything else (appointment history, current meds etc.).
The PatientNumber field on the Assesment Layout, when selected enters a lot of identifying data for that patient, which otherwise would need to be entered individually. Having the Patient Number field on this layout is one way of identifying the record. But what is wrong with the script that the value from the last record isn't entered for me? (The script is not paused)
Sorry, each patient has multiple 'child' records based on one parent record.
If your child records are displayed in a portal on the patient record and "allow creation of records via this relationship" is enabled. This will happen automatically.
If you do not use the portal, you have to set this up yourself as FileMaker has no way to "know" which parent record should be linked to the new child record. How you set this up depends on your layout design. If you start with the patient layout, you can write a script that captures the PatientID in a variable, goes to the child layout, creates a new record and enters the PatientID for you. This script can also put this number in either a global field or a global variable and then an auto-enter calculation defined for the child record's PatientID field can copy the value from this global field or variable into the new record's PatientID field.
This is about trying to make a new child record from an existing one via a button. While on the assessment layout in browse mode, I'm clicking on a button called 'New" which should bring up a new assessment record with the patient number already entered. The Patient Number, is a serial number on the Patient layout. in the related layouts, it's a Number chosen from the Field- Patient::PatientNumber so that the child record in Assessment (And Discharge) show the same number as the Patient (parent) record.
Before you can do this, you have to select a patient record at least once. How will you do that? If you find the patient record on the Patient layout and click a button to switch to this layout, the script can capture the PatientID number and put it in a global variable:
set variable [ $$PatientID ; value: Patients::PatientID ]
Go to layout [assessment]
In the assessment table, define this auto-enter calculation on its patient ID field:
Every new record in this table will then automatically get the value stored in the global variable.
That has fixed that. And I was able to use the variable in other scripts while opening other layouts!
Thanks PhilModJunk. Invaluable support.