October 27, 201312 yr Hi everyone My first ever post. Getting to grips with filemaker, absolutely love it but im such a novice, taking me ages to create a decent database. Im an optometrist making a database to hold my patients' information, i.e. Personal data and their spectacle prescriptions. Now, i have a table and layout for 'Patients' which has many tabs with info from related tables. I have set up relationships correctly and can successfully implement 'portals' to display different related data in different tabs. One of the tabs is spectacle prescriptions. Now, its easy for me to create a portal in the patients layout on one of the tabs and then have the data from the Prescriptions layout displayed in that (related records only of course), however, as you may be aware a spectacle prescription has so many fields and they look incorrect if placed in a straight row, they need to be put into various places for them to make sense. I have done this in the portal and it looks ok with alternate fill background, but it doesnt look very good and easy to browse with the vertical scroll bar. What i'd like is for a button on the prescription tab in patients layout, to be pressed and that would create a new record in the prescriptions layout, then display that blank related record immediately in the patients layout where i can fill the fields in (not in a portal). I would also like to have a date field on that tab which displays all the different prescriptions, where i select one date and it displays the prescription in the corresponding fields. I then click another date and it shows the other prescription etc. Any help would be much appreciated Thanks
October 28, 201312 yr Hi ishaqmir, Welcome to FMForums. Since you're new to Filemaker I'll spell out a simple script. Forgive me if I state the obvious. What i'd like is for a button on the prescription tab in patients layout, to be pressed and that would create a new record in the prescriptions layout, then display that blank related record immediately in the patients layout where i can fill the fields in (not in a portal). To your button you will need to attach a script. The script would look something like this: Set Variable [$patientID, Value: "Patient ID"] Go to Layout ["Prescriptions" (Prescriptions)] New Record/Request Set Field [Prescriptions::Patient ID; $patientID] If you are changing to a new tab, rather than a new layout, you would first name the tab in Layout mode. Then use the Go to Object script step, instead of the Go to Layout script step.
October 28, 201312 yr Regarding your second question: I would also like to have a date field on that tab which displays all the different prescriptions, where i select one date and it displays the prescription in the corresponding fields. Here's a step by step approach: 1. Create a relationship between Patient and Prescriptions via the patient ID. 2. Use this relationship to create a portal showing the prescriptions on the Patient layout. 3. Place the field for the "Date of prescription" in this portal. 4. Also define a new field on the Patient table called "Date_selected". 5. Create a new Table Occurrence on your relationship graph for the "Prescriptions" table (lets call it "Selected prescription"). 6. Make a relationship between Patients and Selected prescription that matches both the Patient ID and also matches "Patients::Date_selected" to "Selected prescription::Date". 7. Place the fields for the Selected prescription on the Patient layout. 8. Place a script trigger on the "Date" field in the Prescriptions portal (from step 3), which sets the "Date_selected" field to the date that user selects. I hope that make sense.
October 29, 201312 yr I believe you could get by by showing the selected prescription in a filtered portal, using the existing relationship.
October 29, 201312 yr To your button you will need to attach a script. The script would look something like this: Set Variable [$patientID, Value: "Patient ID"] Go to Layout ["Prescriptions" (Prescriptions)] New Record/Request Set Field [Prescriptions::Patient ID; $patientID] I just want to clarify … the line in red … in the value you would just select the field and it would show as Patients::PatientID and not as "Patient ID". This is what Matthew meant I'm sure but the quotes could be misleading and should not be used here; in scripts, the table occurrence is always included and you want to reference a field and not quoted text. :-)
November 23, 201312 yr Author Really want to thank everyone again for this as it's been a major leap forward for my database :-)
Create an account or sign in to comment