Jump to content

Scripting


REGGIE MAGER

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

Recommended Posts

I hope someone can help me with a script that I'm trying to write. While in my Customer database I would like to select the account number of the current record then open my Orders database and copy the account numer into the Account No. field. I tried the following script:

Copy [select; Customers::Acct No.]

Open File ["ORDERS"]

Go to Layout [original layout]

New Record/Request

Paste [select; ORDERS::ACCOUNT NO.]

but all it does is open a new record in Orders and places the cursor in the Account No. field. I know I'm overlooking something, but I don't know what. I've tried different things with no luck. Thanks.

Link to comment
Share on other sites

It is possible, but probably not very useful in the way your using it.

It's useful for splitting things like interface and data, reports, and data modules in very large solutions, but probably not in something this size.

In something this size, you will save yourself a lot of effort by just using one file with many data tables. E.g. one file, 3 tables, People, Orders, Cars .. then just join people and cars through orders.

Link to comment
Share on other sites

Sorry to ask this question again, but I'm still having a problem with a script that I'm trying to write. While in my Customer database I would like to select the account number of the current record then open my Orders database and copy the account numer into the Account No. field. I tried the following script:

Copy [select; Customers::Acct No.]

Open File ["ORDERS"]

Go to Layout [original layout]

New Record/Request

Paste [select; ORDERS::ACCOUNT NO.]

but all it does is open a new record in Orders and places the cursor in the Account No. field. I know I'm overlooking something, but I don't know what. I've tried different things with no luck. Thanks.

Link to comment
Share on other sites

I would try to stay away from copy and paste. Why should you litter up your user's clipboard unncessarily. A better way to handle it would be to use a global field to temporarily store the acct number and then use a setfield.

Link to comment
Share on other sites

It can also be handled this way, make two scripts:

1) In the Customers file make a script called Transfer:

If [ IsEmpty ( Get ( ScriptParameter ) ) ]

     Perform Script [ “Transfer”; Parameter: Customers::Acct_no ] 

Else 

     Open File [ “ORDERS” ] 

     Perform Script [ “createNew” from file: “ORDERS”; Parameter: Get ( ScriptParameter ) ] 

End If
 



...and 2) a script in the ORDERS file, which goes:




New Record/Request 

Set Field [ ORDERS::AccountNumber; Get ( ScriptParameter ) ] 

But I fully support John and Alex that the task at hand better are dealt with utilizing $variables as well as a proper relational structure where Customers are related to Orders.

--sd

Link to comment
Share on other sites

This topic is 6261 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.