Hot Topic (More than 10 Replies) Import error (Read 1490 times)
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Import error
Sep 13th, 2011 at 3:47pm
Print Post Print Post  
I have just realized that several thousand records that I imported from Q&A into Sesame have errors. The error was made on the Q&A ASCII export. The inch symbol " was replaced by the foot symbol ' so I have things such as 94' x 31'6'... instead of 94" x 31'6"...

If I delete the incorrect records and do the import again, I will lose any changes that have been made. Right now, I am trying to determine if I want to take this risk.
If I do decide to do this all over again, how do I get Q&A to export the " correctly?

Glenn
  
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: Import error
Reply #1 - Sep 13th, 2011 at 6:26pm
Print Post Print Post  
Hello Glenn,

What you can do is translate the Q&A file into a temporary Sesame file named something like Temp.db. Then in the temporary Sesame file, retrieve the records you wanna export, and run the export the records out to a text file. Then in your Main file, import the text file, and spot check a few records. Then you can delete Temp.db and Temp.dat.

What Sesame does(That Q&A does not) when exporting a " character is it escapes it using a backslash(\) character so in the export file 94" x 31'6" would appear as 94\" x 31'6\" and when Sesame imports it, it will import back in as 94" x 31'6"

-Ray
  

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



Posts: 47
Joined: Mar 18th, 2011
Re: Import error
Reply #2 - Sep 13th, 2011 at 8:26pm
Print Post Print Post  
But, when Sesame exports, it exports numbers with extra zeros, so $150.00 comes out as $150.000000. That causes more problems than the " coming out as '.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Import error
Reply #3 - Sep 13th, 2011 at 8:34pm
Print Post Print Post  
magicfish wrote on Sep 13th, 2011 at 8:26pm:
But, when Sesame exports, it exports numbers with extra zeros, so $150.00 comes out as $150.000000. That causes more problems than the " coming out as '.

What problems does that cause?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: Import error
Reply #4 - Sep 14th, 2011 at 2:30am
Print Post Print Post  
Before the translation you MUST remove ALL double quotes or the CSV records will get screwed up.  That is a CSV "thing", not a QA or Sesame "thing". Just as you can't use slashes or colons in filenames, the double-quote character ASCII 34 is an "illegal" character in CSV files because it is used as the CSV field delimiter.

This can be done using a Mass Update for each field that contains the double-quote character.

For each QA field that needs to be sanitized use this as the update spec: #1=@Replace(#1,@chr(34),@chr(96))

The number after the number sign must be different for each field.  That will replace all double-quote characters with a back-apostrophe (the one under the tilde on a U.S. keyboard), which is normally unused.  If you really want to keep the double-quotes, you can run the same update in reverse in Sesame. It probably would be better, however, to replace the back-apostrophes with two regular apostrophes.

Then translate to Sesame.
  
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: Import error
Reply #5 - Sep 14th, 2011 at 1:19pm
Print Post Print Post  
Rick_R wrote on Sep 14th, 2011 at 2:30am:
Before the translation you MUST remove ALL double quotes or the CSV records will get screwed up.  That is a CSV "thing", not a QA or Sesame "thing". Just as you can't use slashes or colons in filenames, the double-quote character ASCII 34 is an "illegal" character in CSV files because it is used as the CSV field delimiter.

This can be done using a Mass Update for each field that contains the double-quote character.

For each QA field that needs to be sanitized use this as the update spec: #1=@Replace(#1,@chr(34),@chr(96))

The number after the number sign must be different for each field.  That will replace all double-quote characters with a back-apostrophe (the one under the tilde on a U.S. keyboard), which is normally unused.  If you really want to keep the double-quotes, you can run the same update in reverse in Sesame. It probably would be better, however, to replace the back-apostrophes with two regular apostrophes.

Then translate to Sesame.


Hello Rick,

Sesame will translate a Q&A file that has field data that has double quotes in it. Now if you Translate a file, Work with it, Delete all records, Export from Q&A and then Import into your existing Sesame file, Yes you will need to do as you have pointed out.

-Ray
  

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



Posts: 243
Joined: Jan 29th, 2010
Re: Import error
Reply #6 - Sep 14th, 2011 at 5:20pm
Print Post Print Post  
Thanks for clarifying that.  I had copied (and modified it somewhat) from a thread about exporting text fields from QA and keeping blank lines (which isn't possible it seems).

  
Back to top
 
IP Logged
 
magicfish
Member
*
Offline



Posts: 47
Joined: Mar 18th, 2011
Re: Import error
Reply #7 - Sep 14th, 2011 at 8:19pm
Print Post Print Post  
OK, I did all the mass updates and exports in Q&A (9 fields each in 5 files). Then I got them all imported into my Sesame db. What a chore  Sad
Now I have to do the reverse update in Sesame. I think I'll leave that for tomorrow. I haven't looked yet, but I bet the command is different in Sesame.
  
Back to top
 
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: Import error
Reply #8 - Sep 14th, 2011 at 8:48pm
Print Post Print Post  
The command is basically the same in Sesame except that you don't use # with a number, you use the field name.

Actually, on the Sesame side it's quite easy.  In the global spec for the Mass Update you set up the code for one field (use the field name instead of #1.)  Then you just copy and paste the code for each of the other fields and change the name of the field to be fixed each time.  Then one Mass Update will fix all the fields.
  
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: Import error
Reply #9 - Sep 14th, 2011 at 9:09pm
Print Post Print Post  
Hello Rick,

Rick_R wrote on Sep 14th, 2011 at 5:20pm:
Thanks for clarifying that.  I had copied (and modified it somewhat) from a thread about exporting text fields from QA and keeping blank lines (which isn't possible it seems).


To preserve the blank lines you can do the same thing. Translate to Sesame, Export from Sesame and then import into your other Sesame file. Voila! Blank lines and multi-line data intact.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
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: Import error
Reply #10 - Sep 14th, 2011 at 9:19pm
Print Post Print Post  
magicfish wrote on Sep 14th, 2011 at 8:19pm:
OK, I did all the mass updates and exports in Q&A (9 fields each in 5 files). Then I got them all imported into my Sesame db. What a chore  Sad
Now I have to do the reverse update in Sesame. I think I'll leave that for tomorrow. I haven't looked yet, but I bet the command is different in Sesame.


Hello,

Well since you've gone this route, the Mass update in Sesame is the same syntax, as Rick R pointed out, with the exception of numbering. In the Mass Update spec choose any element other than Global Code(This event only runs once per Mass Update), and put all your programming into that element's Mass Update event. Such as

Code
Select All
Width = @Replace(Width,@chr(96),@chr(34))
Length = @Replace(Length,@chr(96),@chr(34))
Height = @Replace(Height,@chr(96),@chr(34))  



-Ray
  

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



Posts: 47
Joined: Mar 18th, 2011
Re: Import error
Reply #11 - Sep 15th, 2011 at 7:44pm
Print Post Print Post  
That worked great. It was actually a lot easier on the Sesame end than on the Q&A end and didn't take long once I got a chance to get around to it.
  
Back to top
 
IP Logged