Solved

FM - Creating a New Portal Row Via a Script, Part II

Posted on 2011-03-13
5
829 Views
Last Modified: 2012-05-11
Searched EE and found nothing specifically on this.  I learned how to create a portal row when I had allowed the creation with the Relationship.  However, this time, my customers did not want to have an empty row (a portal row is only added once per year).  Is there any way to create a portal record other than navigating to the related layout and coming back (I've already done that just now)?  In FM''s script steps, I've noticed that there is a delete portal row step, but no create portal row, which would be nice.  Thanks.

0
Comment
Question by:rvfowler2
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:North2Alaska
ID: 35127920
As far as I know, there is no create portal row method other than scripting a goto layout, set the key and back to layout.  (At least that is the way I've always done it...)
0
 
LVL 24

Accepted Solution

by:
Will Loving earned 300 total points
ID: 35128354
N2A is correct as far as I know. You have to capture the key (ContactID, etc.) using Set Variable, go to a layout based on the table that you want to create the record in, create the record, set the key field using the variable, and then return back to the original layout, often with a "Refresh Window" step.

Set Variable [ $ContactID ; Value: <theContactID> ]
Go to Layout [ Notes ]
Create Record
Set Field [ ContactID ; $ContactID ]
Go to Layout [ original layout ]
Refresh Window [ ]

However, my preferred method here is to use one of my master scripts called "Open new window OFF-Screen", which opens a new window using Height and Length = 0 and position -200 top and -200 left. The name of the window can be generic but I use an optional script parameter to set the name of the window based on what it's doing for trouble-shooting purposes. Some people go further and set a second script parameter that includes the layout name but because layout names can change I prefer not to do that.


Set Variable [ $ContactID ; Value: <theContactID> ]
Perform Script [ Open Window OFF-screen ; Parameter: "Add Note record" ]
Go to Layout [ Notes ]
Create Record
Set Field [ ContactID ; $ContactID ]
Close Window
Refresh Window [ ]

If your portal is sorted by something other than creation date descending, so the most recent record is always on top, you can get your new record to sort to the top by doing the following:

1. Create a calc field in the related table that checks to see if a field the user would ALWAYS fill in is filled and if so set that calc result to 1.

2. Set your sort order for the relationship from the primary table to the child table to include that calc field as the first sort value. That way, if the field is empty, that record will always sort to the top. The Refresh Window [] step is essential to getting the portal to sort properly if you use this method and sometimes a Commit Record step as well.
0
 
LVL 12

Assisted Solution

by:North2Alaska
North2Alaska earned 200 total points
ID: 35128521
I stand corrected.  I did a little research and found a example of creating a related record without having to go to the layout.  I found the reference in this Thread.  There is a comment made by Bruce Robertson close to the end of the thread that points to an example at Download Example

It is a very clever method that uses global fields and multiple relationships (some with the Allow creation of records checked but not displayed.)  Very nice and I have a couple of places I can use this method.

Time to go to work and implement this idea...  :-)
0
 
LVL 24

Expert Comment

by:Will Loving
ID: 35128598
I recall now seeing this method many years ago but it was not nearly so well-delineated. The only (minor) downside is the proliferation of relationships solely for creating records. Thanks for posting the link.
0
 
LVL 2

Author Closing Comment

by:rvfowler2
ID: 35129626
Thanks.  For me personally, I prefer to not create all the extra relationships, etc., just to avoid going to a layout.  Was hoping for something simple.  Following is how I did it and it works fine.  It is also so fast that you don't even see it going to the next layout.  However, thanks for all the research and info.  Valuable.  Will, I'm going to have to research this master script idea that you keep talking about.  Know nothing about that.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now