8 Replies Latest reply on Oct 16, 2016 7:51 PM by philmodjunk

    Related page/layout (?)

    bleyden

      I am having some trouble, and am going to do my best to explain this with some screenshots I took which may make it easier.

       

      I currently have this page as my main dashboard. 

      This layout is tied to my table "Individuals" which has the fields "First Name" "Middle Name" "Last Name" "SHID" "Notes". 

       

      I have another table "Demographics" which is related to the Individuals table by the SHID.  When I click on the button "Demographics" under "Basic Information"  I want to be taken to the layout below, but still be connected with the individual's layout, i.e see the first, middle, and last name, SHID, and notes. 

      I tried using a Go To Related Record for when the demographics button is pressed, but this would  not work because there was no demographics record made, and I also tried converting it to a script and adding a NewRecord command before the Go To Related Record, but that cleared the naming information.

       

      If I need to clarify anything please let me know!  Thanks for any and all help!

        • 1. Re: Related page/layout (?)
          philmodjunk

          Set variable [$ID ; value: individuals::SHID]

          go to layout ["demographics" (demographics)]

          new records/request

          set field [demographics::SHID ; $ID]

          • 2. Re: Related page/layout (?)
            bleyden

            Great!  I did some tweaking to get me to the right page, but I still dont have the name/SHID displayed on the top part of the demographics layout.  Is there an addition to the script that could pull that information in to display it?

            • 3. Re: Related page/layout (?)
              philmodjunk

              Better check your relationship and layout setup. No other steps should be needed.

               

              My response requires the following relationship:

              individuals::SHID = demographics::SHID

               

              and layout setup for demographics should then list "demographics" in Show Records From.

               

              Also, your name field on the demographics layout should specify individuals::name.

              • 4. Re: Related page/layout (?)
                bleyden

                I got it!  The relationship got messed up, but I set it to the correct fields and everything works now!!

                 

                Thank you so much for all of your help!

                • 5. Re: Related page/layout (?)
                  bleyden

                  Sorry to keep bothering!  I just tested it out and it works perfect, but one issue I am seeing for the demographics is that after the first time I go in and add the demographic information, and go back to the dashboard, if I go back to the demographics it enters a new record instead of showing the information that was previously entered.  Is there a way to make it conditional where if there is a matching record it shows that instead of creating a new one?

                  • 6. Re: Related page/layout (?)
                    philmodjunk

                    If [ IsEmpty ( Demographics::SHID ) ]

                       #Put original script here

                    Else

                       Go To Related Records

                    End IF

                     

                    But you might consider an approach that requires no scripting and no additional layout. Put a popover button on your layout and put the fields from Demographics inside the popover. You can enable the "create" option and then, if there is no record, entering data into any of the Demographics fields, creates the new related record with the correct ID in the SHID field. If the record has previously been created, you see that data in the fields and any edits will simply edit the existing record.

                    • 7. Re: Related page/layout (?)
                      bleyden

                      I got it to work perfectly with the popover, both the demographics and the contact information!!

                       

                      One quick popover question and then I think I am done for a while!  Is it possible to make it so that the popover is not centered with the button, i.e. if I had a popover coming from the side of a button, can it extend just a little above the button and more below the button, instead of being equidistant on each side?

                       

                      Not sure if that makes sense, I can send screenshots if necessary.

                      • 8. Re: Related page/layout (?)
                        philmodjunk

                        The options that you see in the setup dialog are it. And those are just the "preferred" option. The position of the popover will automatically adjust when in Browse mode to fit your window even if it has to pop out of a different side of the button.

                         

                        One trick that might work is to make your actual popover button invisible and position it in a different part of your layout. Then use a regular button with go to object to open the popover. This requires giving the popover panel, not the button an object name to go to. The final part would be to use the inspector to make the popover border and "frame" transparent leaving something that now looks very much like a modal dialog opening on your layout.