Solved

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

Posted on 2003-10-31
4
758 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

617 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