Jump to content

inserting number from an imported file


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

Recommended Posts

I am importing fields from database #1, which adds those fields to a new record in database #2. In my import script, after the fields are imported and before it closes database #1, I would like it to copy/paste the new record number (autocreated) in database #2 to a field in the original database (#1). Is this confusing enough? I have tried adding cut and paste in the script, using the relationship, but it doesn't work for some reason. Any ideas?

Thanks,

Dave

Link to comment
Share on other sites

First, are you importing more than one record at a time between db #1 and db #2? If not, then you should use Set Field, rather than cut & paste to get your number into the field in db #1.

If you are importing 2 or more records at a time, then you will need to create an identical found set in both db's, sorted the same way. Then you could run a pre-written looping subscript in db #1 that does a Set Field in each record as it goes, but it would probably be easier & faster to reimport the ID number from db#2 back into db#1 (also after finding & sorting records).

A question about db#1: IOf the autocreated ID number appears in db#2, does this mean that db#1 does not have a unique record ID until this number comes back?

Steve Brown

Link to comment
Share on other sites

I am only importing one record at a time. The autocreated number in db2 is a unique number which will never change. When the number is copied to db1, this is just a way to map that record to the newly-created record. I could probably explain this a little better. What I have is 9 people with their own individual databases. When they fill in a form (which they only have one layout), it autocreates a number for that record. I will have nine scripts that import that particular record into my main database. When the new record is created, they need a way to map their record with the corresponding record in mine. Because our databases do not necessarily have to be up at the same time, I just decided to do a copy/paste, without doing a field relationship.

Link to comment
Share on other sites

I still think you will have better results using Set Field instead of copy/paste in your script.

The reason I asked if db1 has a unique ID field, is so you can set up a relationship with db2. I presume your autocreated field is there for the purpose of establishing a unique ID. But if this field doesn't exist yet in db1, then is db1 itself a database with no unique ID? If so, you'd have a tough time making it relate successfully to db2.

But if you did get the relationship established, you could make a calculation field in db1 where the calculation is the autocreated field name in db2, found via the relationship. That way you wouldn't have to script this at all. The field would fill in as soon as the field autocreates in db2.

But looking at your description, if I understand it correctly, the user is creating the record first, in db2 (and 3,4,5, etc.). Your main db, db1, then imports the newly created record? If so, just import the autocreated field as well. If a version of the record already exists in db1, then there would have to be a relationship so you could have the new info match up with the older record. Thus, there'd have to be a unique ID field in db1 first, so you wouldn't need the autocreated field at all.

If db1 has no unique ID field, you could make one that autofills itself. Then set the autocreation field(s) in db2,3,4, etc. to start from where the new db1 field left off.

How do you make sure your 9 satellite dbs don't accidentally generate the same autocreated number? Do they each work within a different number range?

I think I'm missing something key here.

Steve Brown

Link to comment
Share on other sites

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