I have an export script below. Parts that work include:
1. Patient files exported to the correct folder (not tested on Windows yet) and with the correct filename.
2. Custom dialogue indicates successful export.
Parts I'd like advice:
3. The script exports 3 out of 4 available files. It doesn't only export those records where Patient::Export_record=1.
4. Each exported file contains all the Patient:: fields of all 3 records regardless of the filename given. What I want is the record of only the named patient but I want it to include ALL the related records associated with that Patient record, for examples, all the related records shown in the portals of that record in the 'Patient_L' layout.
Go to Layout [ “Patient_L” (Patient) ]
If [ not IsEmpty(Patient::Export_record=1) ]
Go to Record/Request/Page [ First ]
If [ $Device = 1 ]
Set Variable [ $Filepath; Value:Get ( DesktopPath )&"FC_export files/"& Patient::Lastname& "_" & Patient::Firstname& "_" & Substitute (Patient::BirthDate ; "/" ; "_" ) & ".fmp12" ]
Else If [ $Device = 2 ]
Set Variable [ $Filepath; Value:"Get ( DesktopPath )&\"FC_export files\"&Patient::Last_Firstname&\".fmp12\"" ]
Export Records [ File Name: “$Filepath” ] [ No dialog ]
Go to Record/Request/Page [ Next; Exit after last ]
Show Custom Dialog [ Title: "Export successful"; Message: "Find records on: Desktop > FC export_files"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
Show Custom Dialog [ Title: "No records for export"; Message: "[X] checkbox those records you wish to export."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]