4 Replies Latest reply on Mar 28, 2014 9:40 AM by MichaelPoling

    Weird problem

    MichaelPoling

      Title

      Weird problem

      Post

           Ok, one more little snag.

           I created a new layout based on a new table Demographics_VESTIBULAR.  Relationship chart is below.

           I set it up EXACTLY like I had set up my Demographics_OBJECTIVE relationship, which works just fine.  What it does is when the EpisodeID changes, it makes a new record in that table and allows data entry.

           I set up a button that runs a script calling for it to Go To Related Records from table Demographics_VESTIBULAR and showing the record using the Vestibular layout I created.  I Show only related records and match current record only.  the script then Commits Records/Requests and ends.

           When I click the button, nothing happens.  I checked to make sure I have Add Records and Delete Records check in the relationship.  Given that this is exactly like my Demographics_OBJECTIVE I don't get why this is happening.  

           When I use Go To Layout, it switches to the layout fine and allows data entry, but, of course, it isn't changing with any EpisodeID or PatientID changes.  It just remains on whatever record was open there before.

           So why is Go to Related Record not working, but Go to Layout does?

      Screen_Shot_2014-03-28_at_11.55.28_AM.png

        • 1. Re: Weird problem
          philmodjunk

               From your description, Go To Related Records is not doing anything because, for the current record in Demographics, there are no related records in VESTIBULAR.

               I don't see anything in your description here that would automatically create a new related record in VESTIBULAR. "Allow creation of records..." makes it possible to use the relationship to create a new related record, but it doesn't make it happen automatically.

          • 2. Re: Weird problem
            MichaelPoling

                 Oh!  I wonder why it works with Demographics_OBJECTIVE when I create a new patient record in Demographics?

                 So how can I create that record without creating a new record every time I click the button?  (I want it to go to the record if it exists, or create one if it doesn't.)   Is there something like If Exist, or the like?

                  

            • 3. Re: Weird problem
              philmodjunk

                   I would guess that you have a related record in that case.

                   Since "Allow creation...." has been enabled,

                   Set Field [ demographics_VESTIBULAR::__kfPatientID ; demographics::__kp_PatientID ]
                   Commit Records
                   Go to Related Records [ ...

                   would work. The set field step will create a new record in the related table, but only if one does not already exist. (If a related record exists, the two patient ID fields already have identical values and thus set field makes no actual change to your data.)

              • 4. Re: Weird problem
                MichaelPoling

                     Damn, you're good!

                     Worked like a charm.

                     Ok, I promise to stop posting for a while and give you a reprieve from stupid questions :)

                     Thanks for teaching!

                     Mike