Mandu Posted September 20, 2006 Posted September 20, 2006 (edited) I'm writing a script to populate five tables in my database by importing from five data sources, taking care to set each Primary Key's next serial number. Here's the procedure: Go to Layout ["All Invoice fields" (Invoices)] Import Records [No dialog ; "Invoices.fp7" ; Add ; Mac Roman ] Sort Records [Restore; No dialog] /* sort asc. on primary key */ Go to Record [ Last ] SetNextSerialValue [ Invoices::Invoice_ID ; SerialIncrement ( Invoices::Invoice_ID ; 1 ) ] For the LineItems table I expected to be able to write Go to Layout ["All LineItem fields" (LineItems)] Import Records [No dialog ; "LineItems.fp7" ; Add ; Mac Roman ] Sort Records [Restore; No dialog] /* sort asc. on primary key */ But in Sort Records, Scriptmaker doesn't list "All LineItem fields" as being related to the "current table", Invoices. Why does Sort Records think the current table is Invoices? I don't want to be working through a relationship, I want to be sorting the entire LineItems table, directly. I have the feeling I'm unclear on some important concept. Is a script somehow "pinned to" one table, (this "current table"), and is it limited to accessing only data that's related to the current table? And if so, must one use five separate scripts to Import to five tables? Edited September 20, 2006 by Guest formatting
Ender Posted September 20, 2006 Posted September 20, 2006 ScriptMaker considers the "current table" to be the table for whatever layout happens to be in the foreground when you open ScriptMaker. It doesn't try to change the "current table" based on what the layout gets changed to in the preceeding steps. If the "LineItems" TO is unrelated to your Invoices table, try switching to a layout based on LineItems before going into ScriptMaker to set the Sort.
Mandu Posted September 21, 2006 Author Posted September 21, 2006 I see -- so, for Importing, it doesn't matter what layout I use, only the table upon which the layout is based. Thanks!
Recommended Posts
This topic is 6979 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