GregLB Posted October 27, 2006 Posted October 27, 2006 Hi I am a bit of novice with Filemaker Pro 8 and there is probably a very easy solution to my problem! I have two tables, "Contacts" and "Projects". I want to have the ability to list many projects to one Contact in a portal on the contact layout (I know how to create the portal!), I have two layouts, "contacts" & "projects". I have created a relationship between the two tables as follows: Contact Table: ContactID (Parent) to Project Table: ProjectIDfk (child). I created the field "ProjectIDfk" on the project layout hoping to see the "contactID" information in that field thus relating any project created to the client but I see nothing? Is it something to do with how I initiate the new project record from the Contacts layout? Thanks Greg
Inky Phil Posted October 27, 2006 Posted October 27, 2006 Hi Greg and welcome to the forum There are a number of ways that you can create project records from the contacts layout. First, if you go to your relationship graph and open the relationship in question you will see below the projects side a check box that says ;'allow creation of records....'. If you check this box your portal will always show an 'empty' row below any other records in the portal. Making any entry into this row will create the child record for you and set the key field. Second, you can create a new child record via a script at which time you would pass the key field data by use of a script parameter. The script would be }:|(pseudocode) Go to layout 'any projects layout' New record request Set field (ProjectIDfk;Get(scriptParameter)) Attach this script to a button on the contacts layout. When you do you will see at the bottom of the selection window a field where you can enter a 'script parameter'. Enter there the name of the field that holds the key data in the contacs table. The script will then pass the key field data across from the current record in the contacs table via the 'Get(scriptParameter)' step to the new record in the projects table. I hope that helps. Let us know how you get on Phil
GregLB Posted October 27, 2006 Author Posted October 27, 2006 Hi Phil Thanks for the reply! I am a bit stuck? Have got this far with the script: Go to Layout["Projects" (projects)] New Record/Request Set Field [Projects::ProjectIDfk; Get (ScriptPerameter)] Just not sure of the last part? Do I replace ScriptPerameter with “ContactID which is the key field in the contact table. At this point it works to the point where the project layout opens with the cursor in the target field. Thanks Greg
Inky Phil Posted October 27, 2006 Posted October 27, 2006 OK Greg Your script is working fine. It just doesn't have the data to put into the key field. In layout mode on your contacts layout put a button. Right click the button and choose buton setup. Choose 'Perform script' from the list on the left. Click 'Specify' on the right Choose the script that you have written as the one to perform At this point you will see a field at the bottom of that window where you can enter a script parameter. Click edit next to it Choose the key field from the list on the left hand side and press ok This means that when you click your button the script will be fired and the script parameter will contain whatever is in your key field in your contacts table. This data will be passed across in your script If you now add another line to your script 'Commit Record' I think you will find that your script will now provide you with a new record with the key field filled in HTH Phil
GregLB Posted October 27, 2006 Author Posted October 27, 2006 Hi Phil Thanks for the help. I couldnt get my existing file to work so I made a new simple test file and it with results in portal and it works great so I will just rebuild original again with same principals. just ine more question if you have time? when veiwing the results in the portal how would you make it so that you can click on a record and to open it up in the original layout? Thanks again! Greg
Inky Phil Posted October 27, 2006 Posted October 27, 2006 That's an easy one Greg. You will need another button. This time you set it up not to perform a script but to simply 'Go to related record' which is a bit lower down than 'perform script' Choosing this step will give you a window where you must choose the record to go to. In this case you will nominate the relationship that your portal uses. In the same window you will be able to nominate which layout you wish to display the record in. Easy-Peasy! When working with buttons in portal rows you can nominate any field or group of fields as a button. You can also place an invisible button (fill and line attributes set to transparent) over the whole row. Make sure that the top left hand corner falls within the first portal row. Or Lastly, you can place a small visible button alongside the fields within the portal, once again making sure that it falls into the portal's first row dimensions. Once placed in the top row of the portal this will appear alongside any row of the portal that contains data. Any of the above, given the setting as above will take you to your chosen record Have a good weekend (going home now - UK time). HTH Phil
GregLB Posted October 27, 2006 Author Posted October 27, 2006 Thanks Phil Very simple but would have taken me ages probably to find out. Greg
Recommended Posts
This topic is 6660 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now