Jump to content

Copying from one file to another


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

Recommended Posts

I have two files - one for players and the other for history (stats etc). I want to create a new record in the History when a new player is created in the player file. I'm not using a portal and don't want to. All I want is to copy the new name and the player ID into the History file.

Should be easy but I can't manage it. I thought I could just copy it to the clipboard and it would paste in.

Any ideas ?

Link to comment
Share on other sites

I have a design that requires that data move routinely from one database to another. I have found that writing a script to import your players data into the "history" database can work very nicely. Make sure that you utilize a unique "matching field" in the import so you don't end up with a bunch of useless duplicate information.

Making a relationship based upon each player after that to calculate averages and such should be cake after that.

Link to comment
Share on other sites

I'm sorry, but I don't fully understand your answer. Do I do a find (in a script) that isolates the new record and just import that one record from the player file, adding it to the records that are already there ?

Sorry to sound a bit thick !

Thanks

Link to comment
Share on other sites

Grant, one of the most common ways to pass data between files is with a constant link. In each file create a caculated field that returns a number and give it a value of "1". Give your field a distinctive name like Constant or something that works for you. Create a relationship between the two files using the Constant fields. Make it a basic relationship, Do Not enable the options for deleting of related records or for creation of related records. Now you can use global fields in each DB to pass info between files. For instance in your problem, first create in the history file two global fields, one to hold the ID and another for the name. Then when your new record in players is created use a script to pass the info to the history DB using the constant relationship. Then when the script creates a new record in the history file use the Set Field command to set the ID and Name fields with the data from the globals.

New Record/Request

SetField "ID", "global_ID")

SetField "Name", "global_Name")

Hope that was clear enough to help.

Link to comment
Share on other sites

geodd , thanks for that answer - it works beautifully. The only trouble I had was to copy the new file I had created. It always just took the first. I have a solution, but it probably could be better.

Thanks again !

Link to comment
Share on other sites

  • Newbies

quote:

Originally posted by grant:

I have two files - one for players and the other for history (stats etc). I want to create a new record in the History when a new player is created in the player file. I'm not using a portal and don't want to. All I want is to copy the new name and the player ID into the History file.

Should be easy but I can't manage it. I thought I could just copy it to the clipboard and it would paste in.

Any ideas ?

Create 2 global fields into the the History file. "Name" and "ID".

Create a first script in the player file which will define these two fields with these two informations.

Create a second script which will start at the end of the previous one and will create a new record in the History file and will define the two text) (text) fields Name & ID with the values from the global.

Link to comment
Share on other sites

This topic is 7748 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.