Solved

Best method to transfer data from one database to another within the inbuilt scripting environment.

Posted on 2003-10-31
4
748 Views
Last Modified: 2010-04-27
What is the best method to transfer data from fields in one related database to fields in another only using the inbuilt scripting.

I am creating a school database and have to transport values from a database called "behaviour level report" to a related database called "welfare record".

It is easy enough to transfer values between layouts using the copy, paste functions etc. however. the ability for one database to issue  commands in an external database (related) appeares to be limited to basic functions such as  "open file welfare record". From that point on you loose controle.  I can't then copy specific field values into fields in this external database.
0
Comment
Question by:naubrey
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Mariano_Peterson earned 250 total points
ID: 9660454
This is from a previous post of mine at another list:
----------

There are several ways of doing this. I'll describe the method I use:

This exampe assumes you have three files:
Main.fp5
Parent.fp5
Child.fp5

Main.fp5 should have the following fields:

zkg_newID (global number)


Parent.fp5 should have the following fields:

zkp (primary key, number, auto-enter serial)
zkg_newID (global number)
field1 (any data field)


Child.fp5 should have the following fields:

zkp (primary key, number, auto-enter serial)
zkf_parentID (number, foreign key to parent table)
field1 (any data field)


Parent.fp5 should have the following relationship:

Relationship Name: Main.Constant_NOT
Related file: Main.fp5
Left field: zkg_newID
Rigth field: zkg_newID
** When you create this relationship, you'll get an alert warning you that this relationship will not work. This is OK.

Relationship Name: Child.New
Related file: Child.fp5
Left field: zkg_newID
Right field: zkp


Child.fp5 should have the following relationship:

Relationship Name: Main.Constant_NOT
Related file: Main.fp5
Left field: zkg_newID
Right field: zkg_newID
** When you create this relationship, you'll get an alert warning you that this relationship will not work. This is OK.


Child.fp5 should have the following script:
Script Name: "NewRec (external)"
Script Steps:
Allow user abort [Off]
Set Error Capture [On]
Enter Browse Mode []
New Record/Request
Set Field [Parent.constant_NOT::zkg_newID, "zkp"]

---

Now that you've created an infrastructure, we can create related records and set values in them easily.

From Parent.fp5, lets create a script, "CreateChild":
Script Name: "CreateChild"
Script steps:
Allow user abort [Off]
Set Error Capture [On]
Enter Browse Mode []
#
# Create a child record and get a pointer to it
Perfom Script [Sub-scripts, External: "Child.fp5", "NewRec (External)"]
Set Field ["zkg_newID", "Menu.Constant_NOT::zkg_newID"]
Exit Record/Request
#
# Set attributes for the new child record:
Set Field ["Child.New::zkf_parentID", "zkp"]
Set Field ["Child.New::field1", "field1"]
Set Field ["Child.New::field2", ""any data here""]
Set Field ["Child.New::field3", "field3"]
... etc ...


---


This methodology is convenient because it allows you to easily set as many fields as you like in the child file -- and the changes are limited to a single script. Also, by avoiding the use of copy/paste or setting globals in script and then reading them in another, you make the code more compact, less error-prone, and easier to debug.

As long as you're careful to maintain the infrastructure by including the "zkg_newID" field, the "NewRec (external)" script, and the "Main.Constant_NOT" relationship in every file, you can easily create a record in any file at any time without having to add fields, scripts, or relationships.

Hope this helps!

0
 

Author Comment

by:naubrey
ID: 9669524
Thanks for your reply
Apologies for the time. I was waiting for some more answers as your answer didn't quite fit my solution and I had to work it through.

Probably not the best solution however:
I ended up getting my result by

setting the value of fields to a global fields.

Using the  "external script function" to paste in the values into the related fields.
0
 
LVL 3

Expert Comment

by:Mariano_Peterson
ID: 9673228
Avoid pasting; it does not offer consistent behavior and is highly error prone.  It is considered extremely bad programming practice to use copy/paste.  Instead, use the set field script step.

Using global fields works fine, but creates the unnecessary overhead and inconvenience of having to add new global fields every time you want to transfer an extra value.

Good luck,
Mariano
0
 

Author Comment

by:naubrey
ID: 9674908
Apologies for my use of the word paste. I am using the set function.
Thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now