Can you create a related record and set fields in a script without the clunky code of going to a another layout with portal, etc.?
chuckburr wrote:[…] going to a another layout with portal, etc.?
[…] going to a another layout with portal, etc.?
If you use a portal, you don't need to go to another layout.
But kidding aside: search this forum for "Magic key".
If you're already writing a script, what is clunky about adding a new window to go to a layout (you can set the window postition to be Left: -5000 or something so no one can see it) create a new record, set the fields and then close that window?
Search for "FileMaker magic key". Awesome.
I only wish there was a similar method to delete related records.
eroist, I'm not sure what you mean by this. It's easy to script the creation of a new record. You don't need to create a portal at all. I'd suggest this:
1. Open a new window and a layout for the table for which you want to create a new record
2. Use a card window for this, and you can make it not appear on the screen by setting the placement to be 2000 points (not pixels) from the left.
3. Populate the fields with the script steps (usually this is the Set script step)
4. Close the window, refresh screen
The magic key method that Vaughn suggests is excellent but maybe more than you need at this point.
Retrieving data ...