Hot Topic (More than 10 Replies) Importing records with subrecords (Read 1341 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Importing records with subrecords
Nov 9th, 2005 at 8:46pm
Print Post Print Post  
I recently imported about 6000 parent records into a rebuilt database which contained a subform (table mode) and it went fairly smooth. However, a few records did not import with ALL of its respective subrecords. Rather, SEVERAL parent records were created along with 1 subrecord each.

Example, a single parent record should have imported with 10 subrecords attached, but instead I got 10 parent records with 1 subrecord each.

Any idea what caused this? What 'trigger' is telling sesame to start a new parent record during the import process.

Thanks,
Steve
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Importing records with subrecords
Reply #1 - Nov 9th, 2005 at 8:53pm
Print Post Print Post  
If you have a parent with three fields, and a child with two fields, and the parent has four children, you should see in the ASCII file, a pattern like this, for that parent:

A B C D E
A B C F G
A B C H I
A B C J K

If the next record has three children, it would be followed by:

L M N O P
L M N Q R
L M N S T

Here the letters represent different field values. The repetition of the parent field values, tells Sesame that the line in the ASCII file is intended to fill out a child of that parent.

So, look through your ASCII file and look for a failure in that repetition at the point where you are seeing an erroneous parent being created.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Importing records with subrecords
Reply #2 - Nov 9th, 2005 at 8:57pm
Print Post Print Post  
Wow! Another LIGHTNING fast response. You all are truely amazing.

Thanks for your help, Mark. I'll take a look.

Steve


  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Importing records with subrecords
Reply #3 - Nov 9th, 2005 at 9:13pm
Print Post Print Post  
What Mark is saying, for everyone that does not understand Cow-speak, is that all the fields on the parent form have to match in order for Sesame to know that the parent record is the same and to populate it's children. If one field is even slightly different, such as an extra space, then Sesame does not see the records as being the same.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Importing records with subrecords
Reply #4 - Nov 9th, 2005 at 9:56pm
Print Post Print Post  
LOL! I found the error and re-imported the bad records.

All is well now.

Thanks to the Cow and Ray for the translation. Smiley

Steve
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Importing records with subrecords
Reply #5 - Nov 9th, 2005 at 10:01pm
Print Post Print Post  
Steve,

Just out of curiosity, what was the problem?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Importing records with subrecords
Reply #6 - Nov 9th, 2005 at 10:46pm
Print Post Print Post  
My old database picked up some duplicate parent records because of an issue with the 'natural linking' (and perhaps because I was saving and reloading a form during sbasic programming?). The dupe record had 0 subrecords, but the original parent had several subrecords. Deleting the dupe caused both records to disappear, or sesame would crash and I could not export anything. I was only able to export succesfully by deleting the natural linking, and rebind them relationally. I could then export successfully.

Apparently, when I exported the data from the damaged DB, the dupe parent records were exported also and that caused the .csv file to get out of whack.

I wish there was a way to 'search and destroy' any subrecords that had corrup natural linking. Perhaps in 2.0?

Thanks for asking.

Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Importing records with subrecords
Reply #7 - Nov 10th, 2005 at 1:22am
Print Post Print Post  
Quote:
I wish there was a way to 'search and destroy' any subrecords that had corrup natural linking.

I just found a stray subform record in one of my apps.

This is the process I used:
1) Make a temporary backup copy of your app.
2) Open that temporary copy.
3) Retreive all of the main form (parent) records.
4) After double checking that you are looking at the temporary copy, perform a Mass Delete of all the parent records.
5) Open the subform as standalone in Search/Update mode, and press F10 to see if there are any subform records. If there are, they are orphans, because they should have been removed when the parent records were deleted.

Now, this brings up an issue. How did my app get an orphan subrecord? I am using Natural linking. (I understand how it could happen with Relational linking if my programming failed to fill the key field or some such problem.)

I wonder if this would happen if I created a subrecord, but failed to save the main record?

Ray, it seems that I remember you, or someone at Lantica, explaining something similar to this. Am I correct here?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Importing records with subrecords
Reply #8 - Nov 10th, 2005 at 2:41pm
Print Post Print Post  
Hello Carl,

Yes, If you save a child record but do not save the parent record, the child will be saved without a link to a parent.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Importing records with subrecords
Reply #9 - Nov 10th, 2005 at 2:42pm
Print Post Print Post  
Thanks Ray.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Importing records with subrecords
Reply #10 - Nov 10th, 2005 at 3:49pm
Print Post Print Post  
Carl's method works good, but isn't there a simple way to Retreive all children records without parents that use natural linking? 

Can't we put in a retrieve formula using some kind of undocumented, hidden link field?

Or how about a method to remove children saved when parent is closed without saving?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Importing records with subrecords
Reply #11 - Nov 10th, 2005 at 4:09pm
Print Post Print Post  
Lets not forget about the records that become 'unlinked' due to corruption...or should I say, if a meteor shower causes a naturally linked record to lose its parent.

Can we recreate the link? Can we 'delete' the corrupt link?

I'm finding that just 1 corrupt link can cause major issues.

Steve
  
Back to top
IP Logged