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

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

Recommended Posts

Posted

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.

Posted

A couple of questions

1) Is there any reason you have created a seperate database for orders?

2) Is this a single user solution?

Posted

Yes, this is a single user solution. I thought I had to use separate databases and join them together to keep track of customers amd their cars and pull that information into my order form. Is it not possible to use a script to work between databases if they are joined?

Posted

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.

Posted

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.

Posted

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.

Posted

You will however have to either move the tables to your main file (then you can use a variable), or add a file reference to your other file to use the method john suggested.

Posted

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

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