Please describe what you mean by "sync".
What kind of data are you putting in the two portals and why do you need two portals if they link to the same records?
Basically I have a layout with the patient general data, and one portal with the clinical record of the day, but I also have 6 large images I have to figure out how to fit in the screen, so I decided to use a tab control outside the portal (because will not working inside) with 6 tabs, and each tab have a portal inside with just 1 image. So, I´m trying to make the image on each tab to be related of the clinical record selected.
Of course I accept any ideas to solve it.
Again, thanks a lot!
Let's assume your portal table has a serial number field that uniquely identifies each record in the portal named DailyClinicID.
You can make a new occurrence of your ClinicalRecord table and set up a separate relationship for the images in the tab control.
In Manage | Database | relationships, make a new table occurrence of ClinicalRecord by clicking it and then clicking the duplicate button (2 green plus signs). You can double click the new occurrence box to get a dialog to appear where you can rename the new occurrence box as selectedClinicRecord.
We have not duplicated a table. Instead, this is a new reference to the same table already present in your database.
Add it to your relationships like this:
Patients::gSelectedClinicID = SelectedClinicRecord::DailyClinicID
A button in the portal row and/or script triggers on the portal fields (if they need to be editable) can perform this script:
Set Field [Patients::gSelectedClinicID ; ClinicalRecord::DailyClicnicID ]
Add the container fields for your images to the tab controls from the SelectedClinicRecord table occurrence, not ClinicalRecord. No portal is needed you can just add the fields.
You can use conditional formatting on fields in the portal row to change fill colors to highlight the field that is currently "synched" with the images in the tab control.
Note that your current design limits you to a specific number of images for any given daily clinical record. There are other ways to structure your tables that would not limit the number of images and you can then set up an interface where you can either scroll or click through the images associated with a given daily clinical record.
You mean by add a 3th table related to the daily clinical record??
And how could I design the interface?? Using a portal inside a portal??
Thanks for your answer
If you are asking about my final comment, then yes, you'd create a third table related to the clinical record table, but you would not use a portal inside a portal as that can't be done. Just like now, you'd have a separate "synched" portal for displaying the images for a given clinical record. Unlike now, this portal could either have a scroll bar for scrolling through multiple images or you'd use buttons that enable the user to flip forwards and back through the images.
Ok, I´m so sorry but I´m totally lost.
I decided to take your idea and create a 3th table, here is my idea...
1st table Patient:
Id (master record)
many other fields bla bla bla
2nd table Clinical:
Patient (related to Id on Patient table)
IdClinical (auto-enter consecutive)
many other fields bla bla bla
3th table Image:
Clinical (related to IdClinical)
IdImage (auto-enter consecutive)
In a Layout based on Patient I placed all Patient fields, on a portal I placed Clinical fields.
But I can´t get a 2nd portal to work there. I tried SetField, Related Record, Show All Records and many others using Set Script Trigger in the portal or in a external button with no success.
I think I'm lost, what I'm I doing wrong?
Your basic set up appears correct, you just need a separate relationship to bypass the relationship to clinical to get to the image records for just the selected portal row in Clinical. What I am describing is a basic method for displaying the images.
Enabling data entry into the images table will require some additional scripting and possibly a supplemental layout. (There are a number of possible approaches you can use.) A simple approach you can set up to get started is to take the layout that is based on Clinical and add a portal to Images for inserting new images. You can set up a button in the Clinical portal row that uses Go To Related records to bring up the same record on the Clinical layout for inserting images.
What you have in Manage | Database | Relationships would appear to be this:
Patient::id = Clinical::Patient
Clinical::idClinical = Image::Clinical
To show the images in a portal in the Patient layout, you can add a new occurrence of Images and relate it directly to Patient. (See earlier post that describes doing this for Clinical in our first approach.) Name it SelectedImages and relate it like this:
Patient::gSelectedidClinical = SelectedImages::Clinical
That script we used before would be changed to be:
Set Field [Patient::gSelectedidClinical ; SelectedImages::Clinical ]
And you'd use a portal to SelectedImages to display them.
Let me see if I understood...
I´ll create a field on Image tab with label consimag (auto enter consecutive)
I´ll create a field on Patient tab with label consimag (= Image::consimag)
My relationships will then be:
Patient::ID and Clinical::Patient
Patient::consimag and Image::consimag
Clinical::IdClinical and Image::Clinical
I placed a button inside the portal to add images, but I think I don´t understand the script: Set Field [Patient::gSelectedidClinical ; SelectedImages::Clinical ]
What does the ";" means???
And, I´m I right about the fields and relationships???
Hmm, we have some confusion of terms here. You cannot create a field "on a tab". You can only add fields to it using the field tool. The fields must be created in the correct tables using Manage | Database | Fields in order for this to work.
The relationships you list look correct, Image::consiag should be the auto-entered serial number that uniquely identifies each image record.
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.
Thanks a lot!!
Now It´s working perfect.