13 Replies Latest reply on Sep 10, 2013 9:19 AM by philmodjunk

    Portals: Mirroring



      Portals: Mirroring


           I have:

           1. a Prescription < Input relationship and portals for both on the Main layout + a select/script on each prescription record to pull Input records specific to that prescription into the Input portal. All fine.

           2. Problem:

           a) A prescription consists of 1 or more different drugs/dosages. This forms a 'druglist'. I did have this as a separate table/portal from prescription because it made it easier to add/delete portal records. However, there is only 1 druglist per prescription so I am not sure it's appropriate to have a separate table & portal. It would simply things if druglist was within prescription but I'm not sure how I can then add/delete drugs.

           b) Each Prescription drug that is added, needs an Actual input field (among others) listed in the Input portal. How can I mirror Input addition/deletion occuring in Prescription?


        • 1. Re: Portals: Mirroring

               a) am I correct that an entry in the "druglist" can also be a prescription in its own right? Such as acetominophin being listed as both a tablet for headaches and one of three drugs listed it for a migraine medication or when combined with coedine?

               If so, this sounds like something that is very similar to when a retailer offers "package deals", "boxed sets" or "kits" for sale. An item can be purchased (and removed from inventory) as a single item or the retailer can list one of these "group items" on the invoice and then the entire list of items that make up that "set", "deal" or "kit" are included in the sale and deducted from inventory.

               b) There's not enought info here on how you've set this up and how you need it to work to be able to suggest an answer.You'r using terms with specific meanings in this specific line of work but I don't know what they mean "Actual Input"? "Input addition/Deletion"? And how are the tables linked in relationships here?

          • 2. Re: Portals: Mirroring

                 a) The components of the 'druglist' comprise the Prescription. The prescription may hold true for 1 or more days. If any drug or drug dose changes, that makes a new prescription.

                 b) Because drugs/doses prescribed may not actually be delivered (eg. the person refuses or vomits the drug), the 'Input' needs to have each drug listed, but the dose may be different from the prescription. For this reason it would useful if each Input record automatically reflect the druglist in prescription but allow different drug doses to be entered.

                 c) Relationships:

                 - Prescription < Input.

                 - Prescription < Drugs. 1 problem is that each drug is a record on Drugs, so you may be selecting >1 drug (record) from drugs for a single prescription.

            • 3. Re: Portals: Mirroring

                   a) Ok, misread what you meant be prescription. Yes a portal to a drug list linked to a given presecription record makes since if each drug on the list is a separate related record in that table.

                   b) Presumbably, a Prescription record records the patient ID, The date of the first intended dose, number of times aday and the number of days that it will be delivered. It would link to a related table of drugs to provide the list of drugs that make up that prescription. Input needs to list those same drugs but also to record the amount of each actually administered--which is yet another table linked both to prescriptions and to to input.


                   What I would do is set up a script that is run each time a new input record is logged. It would pull up the records in DrugList and create one matching record in InputDrugList for every listed Drug. The actual amount administered would then be logged in InputDrugLIst. Drugs and Drugs|Input would both be Tutorial: What are Table Occurrences? of the same table. And I am guessing that you'll need a Drugs table here separate from DrugList. It sould serve to list each drug avialable for a presecription and document data specific to that drug.

              • 4. Re: Portals: Mirroring

                     OK, I'm part way to working through this. For my DrugList portal I've got a '+' button outside the portal to add new records and a '-' button for each record inside the portal to delete a record. My drugs are specified on a pop-up displayed from DrugList::_DrugID with a value list Drugs::_DrugID showing Drugs::Drug.

                     Obviously every time I add/delete a DrugList record or change the drug I need it mirrored in DrugList_input portal........I'm not sure of the script syntax to achieve both.

                • 5. Re: Portals: Mirroring

                       I wouldn't even try to do that. Since you will be creating a new set of listed drugs each time a dose is administered, I'd create the new set of those records at the time the dose is administered. That list will then accurately reflect the current prescription drug list and thus you won't have to automatically add/remove drugs from that table should you need to modify the patient's prescription as those records will not yet have been created.

                  • 6. Re: Portals: Mirroring

                         OK. A snag is that the fk_InputID related to pk__InputID is not populating. Other fk's in these related tables are similarly setup and populating fine. I assume that for this reason the InputDrugList is not populating.

                         Also I wasn't sure whether your sentence of 3/9/13 was literal: 'What I would do is set up a script that is run each time a new input record is logged. It would pull up the records in DrugList and create one matching record in InputDrugList for every listed Drug.' Do you really mean create 'one' matching record in InputDrugLists? DrugList contains 1 record for each drug chosen.

                    • 7. Re: Portals: Mirroring

                           Better read what I posted again. I did not say "create one record". I said "create one matching record for every listed drug." If DrugList lists 5 drugs in 5 records. Then this script should create 5 matching records in InputDrugList.

                           You'll need to describe your "snag" in more detail before I can suggest much as a fix as there is more than one way to take the list of drugs from the Rx and generate a matching set in Input. The fk field won't populate automatically on its own with most of those methods. (I'd copy the needed value into a variable and then set the fk field to that variable with each newly created record.)

                      • 8. Re: Portals: Mirroring

                             The script triggering a new 'Input' record starts:  Set Variable[$ID;Value:Patient::Prescription_n].........and correctly makes a new record in the Input portal. Following on in the same script:

                             Set Variable[$ID;Value:Patient::FeedList_n]

                             Freeze Window

                             Go to Layout["DrugList" (DrugList)]

                             Set Field [FeedList::_PrescriptionID; $ID]

                             Copy Record/Request

                             Go to Layout ["DrugListInput" (DrugListInput)]

                             New Record/Request

                             Paste [Select]

                             Go to Layout ["L_Patient" (Patient)]

                             This generates new but blank records in DrugListInput......to be honest I'm not sure how to copy records or the IDs, across.

                        • 9. Re: Portals: Mirroring

                               Sorry, but you can't copy and paste records in FileMaker to achieve what you are trying to do here. The Paste will paste all the data from the Copy Records step into a single field. You'll need to use variables like you are already doing with $ID--one variable for each field where you need to transfer data from the drug list.

                               (And the "copy" script steps should be avoided if at all possible. They use the system clipboard and thus users get confused/annoyed when your script replaces data they had copied with data copied during execution of your script.)

                          • 10. Re: Portals: Mirroring

                                 OK re. copy/paste.

                                 However, it's less that I need to transfer data, than ensure that for every drug in the DrugList, there's an 'Input' field in DrugListInput that corresponds to that drug. The following script does create a DrugListInput record, but only 1, instead of a record for each drug listed in the DrugList. Shouldn't DrugListInput be a related child of DrugList? Ultimately, I'll need the DrugListInput to multiply the Drugs (composition) to summarise drug components with the Input table, ie. the all have to relate.


                                 Set Variable[$ID;Value:Patient::DrugListInput_n]

                                 Freeze Window

                                 Go to Layout["DrugListInput" (DrugListInput)]

                                 New Record/Request


                                 Set Field [DrugListInput::_InputID; $ID]


                            • 11. Re: Portals: Mirroring

                                   You need a loop so that you loop through the records that make up your drug list in order to create a matching set of records in DrugListInput.

                                   Using a Tutorial: What are Table Occurrences? of DrugListInput to link it in as a child of the DrugList table is a viable approach to making this work, but you'll still need your loop in order to create the records in DrugListInput.

                                   Hint: the List function can produce a list of Drug ID's from your related set of DrugList records and set variable can store this list in a variable. Your loop can then loop through this list using GetValue and and index variable that increments by one with each pass through the loop to extract each Drug ID to put into the correct field in the DrugListInput table. This can save your script from having to either flip back and forth between two layouts or interact with the rows of a portal.

                              • 12. Re: Portals: Mirroring



                                     Currently relationships are:


                                     < Input &

                                     < DrugList < DrugList_input

                                                         > Feeds

                                The script I attempted (and failed; it only added endless/useless records into DrugListInput despite the EndLoop)  to use to ensure that DrugList_input had all the feeds cited in DrugList was:


                                Set Variable [$ID; Value:

                                GetValue ( List ( DrugList::__DrugListID) ;

                                SerialIncrement ( DrugList::__DrugListID ; 1 ) )]

                                Freeze Window

                                Go to Layout["DrugListInput" (DrugListInput)]

                                New Record/Request

                                Set Field[DrugListInput::_DrugListID]

                                End loop

                                • 13. Re: Portals: Mirroring

                                  it only added endless/useless records into DrugListInput despite the EndLoop

                                  To exit a loop requires either Exit Loop IF [] or the Go to Record/Request/Page [ Next ; exit after last ] step.

                                  End loop is a script step that marks the end of the loop so that FIleMaker knows where to return control back to the start of the loop.

                                  Set Variable [$List ; List ( DrugList:::__DrugListID ]---> this step must execute from the correct record on the Prescription layout
                                  Go to Layout["DrugListInput" (DrugListInput)]
                                  Freeze Window
                                     Set Variable [$K ; Value: $K + 1 ]  ---> you need to count your way through list not increment the ID value
                                          Exit Loop IF [ $K > ValueCount ( $List ) ]  ----> this is the step that exits the loop.

                                     New Record/Request
                                     Set Field[DrugListInput::_DrugListID ; GetValue ( List ( DrugList::__DrugListID) ; $K )]   ----> must have both parameters. See comment below
                                       End loop

                                       When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.