February 21, 200718 yr 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.
February 21, 200718 yr A couple of questions 1) Is there any reason you have created a seperate database for orders? 2) Is this a single user solution?
February 21, 200718 yr Author 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?
February 21, 200718 yr 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.
February 27, 200718 yr Author 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.
February 27, 200718 yr 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.
February 27, 200718 yr 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.
February 27, 200718 yr 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
Create an account or sign in to comment