Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6641 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (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 by Guest
formatting
Posted

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.

This topic is 6641 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.