There are a number of ways. One is to check the box in the relationship to allow creation of related records. This method adds a empty row at the bottom of the portal rows for new entry. This can become a problem when the portal fills up causing the user to have to scroll to the last row to enter a new record.
Another method is to put the parent record ID in a variable navigate to a layout based on the portal table. Create a new record and stamp in the parent record ID.
My favorite, which i have been using for years now, is a method I call 'Create Releated Records without leaving home'.
You can download a version here...
Hope this helps
Thanks for your reply.
First, I clicked on your link and got a scary message (that I've never seen before!) about going to that website. (?)
I have checked the box to allow the relationship, and I have a scroll bar, so that's all good. I guess I did not mean to ask how I create a record in a portal, instead, how do I write a script to start a new record in a portal, and enter a few fields automatically, when there are more than one portals on the Layout?
PS - How do I make it so the new blank record in a portal is at the top instead of the bottom?
To answer your other question about a script. I partially described it by saying "Another method is to put the parent record ID in a variable navigate to a layout based on the portal table. Create a new record and stamp in the parent record ID." The simplest version would be...
Set Variable [ $ParentID ; ParentTable::ParentID ]
Go To Layout - layout based on the portal table.
set field [ ParentID ; $ParentID ]
Go To Layout - original layout
If you need to pass more then one field you can create a return delimited list in the variable. Then use Get Values () to parse the list to the respective fields.
Moving on...The blank row isn't actually a portal row so there is no way to get it to the top.You could create global fields in the parent table that mimic the fields in the portal. Put them at the top as if they are the first row. Then you could put a script trigger on the last entry field that runs a script like the above.
But you should really take a look at the demo (I didn't create the method). Don't worry about the warning. There is nothing wrong with the site.
I deleted my last message as the layout was terrible.
Here is the google report on your site:
Diagnostic page for pueblo-systems.com
What is the current listing status for pueblo-systems.com?
Site is listed as suspicious - visiting this web site may harm your computer.
Part of this site was listed for suspicious activity 2 time(s) over the past 90 days.
What happened when Google visited this site?
Of the 3 pages we tested on the site over the past 90 days, 3 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2013-06-05, and the last time suspicious content was found on this site was on 2013-06-05.
Malicious software includes 5 trojan(s).
Malicious software is hosted on 4 domain(s), including thecardoctorsales.co.uk/, schmidt-wissen.de/, ihacksrepo.com/.
1 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including thecardoctorsales.co.uk/.
This site was hosted on 1 network(s) including AS6245 (NETWORK-SOLUTIONS).
Has this site acted as an intermediary resulting in further distribution of malware?
Over the past 90 days, pueblo-systems.com appeared to function as an intermediary for the infection of 1 site(s) including businessdb.com/.
Has this site hosted malware?
No, this site has not hosted malicious software over the past 90 days.
How did this happen?
In some cases, third parties can add malicious code to legitimate sites, which would cause us to show the warning message.
Return to the previous page.
If you are the owner of this web site, you can request a review of your site using Google Webmaster Tools. More information about the review process is available in Google's Webmaster Help Center.
Updated 1 hours ago
I am going to use your script idea, but I hit a roadblock right at the beginning due to my inexperience.
I'm not sure what you mean by [ $ParentID ; ParentTable::ParentID ]
I think that I should replace "ParentID" with the Field Name of ID field of the Parent table.
And I should replace ParentTable with the Parent Table name.
So when I enter into the calculation window of the Set Variable value - $ParentID ; ParentTable::ParentID, I get an error message that I need an Operator right after the first ParentID...
Thanks in advance for any help.
Darryl, you say: I'm not sure what you mean by [ $ParentID ; ParentTable::ParentID ]
In PSI's script this is a step (Set Variable [ $ParentID ; ParentTable::ParentID ]) which declares a variable which you then use further down the script. $ParentID is simply the name of the variable; ParentTable::ParentID is the name of the table occurence and field from which you will collect the value. So if the ParentID field holds the value, say, PAR/0023, when you set a variable you are simply saying to your computer, "Please remember PAR/0023 for me as I want to use this number in a minute. And call it $ParentID, so I will know what to ask for." Thus you don't have to know the value, only what you have called the value, and you are using your computer sustem memory to remeber the value, rather than making Filemaker do the work. Then a couple lof lines further on in the script you come across set field [ ParentID ; $ParentID ]; this is where you are calling up the remembered value and inserting it into a field (ParentID in the newly created record). All you need to do to utilise this script in your database is replace the field occurrences (ParentTable::ParentID) with ones from your file.
This is a valid method if you are not passing a lot of fields to the child table. If you have to pass a number of fields to the child table the method I gave the link for is preferable, to me at least. BTW: I requested Google web tools to review the site again. It passed so you shouldn't get a warning message anymore.
That's interesting. I wonder why you find passing multiple values this way to be less preferable. I have a file where I decided that controlling entry and maitaining data integrity and accuracy was of sufficient importance that I use a process where the user never interacts directly with "real" records. Data is entered via a temporary record in a data entry table and ALL data (14 or 15 fields) is passed to the actual record via variables in a script; editing involves up and back versions of the same process.
The method I am referring to in my demo is also documented here: http://www.excelisys.com/demos/About_thatPortal.pdf - I think they were the creators of this technique.
This approach allows you to create the related record then send as many other values as you need without changing leaving the parent layout. It does require a second relationship but that other relationship comes is very handy when you need to reference a specific portal record that is already created.
This download worked for me, after I changed the "\\" to "//" - so the correct URL should be:
Having looked at the file, it is really cool… but sort of boggles the mind. There is no "New Record" script step, you just set a field and commit, and some voodoo happens. Almost seems like it's exploiting a bug.
If it works, great… seems a lot cleaner than the normal method of bouncing around to different layouts, or opening and closing windows, etc.
But I'd love to hear from someone at FMI to explain why this works and if it is something that we can rely on continuing to work.
1 of 1 people found this helpful
It's not voodoo or a bug. In the relationship graph you can set options to create or delete records via this relationship. When the portal is based on the table occurence with this entering data in a field based on the table occurence when there isn't a record created, creates the record. If there are multiple fields in the relationship such as a "default" field that requires a value of 1, it will automaticly fill in this field as well.
It just seems like magic and can be very helpful.
thanks for clarifying the // \ issue.
I found this technique in BizTracker a number of years ago. I have been using it through versions 9?, 10, 11 and 12 without a problem.
Also if you have to reference a record in the portal all you have to do i put the child ID into the parent global you used for the create relationship and you are connected.