Set variable [$ID ; value: individuals::SHID]
go to layout ["demographics" (demographics)]
set field [demographics::SHID ; $ID]
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?
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.
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!
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?
If [ IsEmpty ( Demographics::SHID ) ]
#Put original script here
Go To Related Records
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.
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.
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.