Import from CSV - merge records

This forum is for application developers who are integrating HanDBase into their solutions via the HanDBase API (HAPI) or other means. It's also a great place to discuss runtime development.

Import from CSV - merge records

Postby Will_Smyth » Wed Nov 28, 2012 8:54 am

Hi
I have an accounts database and I am extracting the customer data via CSV and importing it into handbase (windows desktop-enterprise).
Due to CSV record length restrictions I need to extract the data to two separate CSV files. I have included the Account code,primary key,
as the first field in each file.
The CSV import gives options to create a new database, import to current DB - erasing existing records and import to existing - appending to existing.
Is there any way of importing the first file and then importing the second with a merge on the primary key?
Will_Smyth
 
Posts: 11
Joined: Mon Oct 08, 2012 11:11 am

Re: Import from CSV - merge records

Postby Will_Smyth » Wed Nov 28, 2012 8:57 am

Sorry I should have said the restriction on the CSV file length is that the accounts system only allow 254 characters per line.
Will_Smyth
 
Posts: 11
Joined: Mon Oct 08, 2012 11:11 am

Re: Import from CSV - merge records

Postby dhaupert » Wed Nov 28, 2012 9:15 am

Hi there,

Thanks for your post and the additional clarification. First, one comment - the CSV format is not necessarily limited to a single line per entry. For example, if there are quotes around each field value, there can be carriage returns (new lines) in the single record. Perhaps if the account system has more than a line of records it's breaking it into multiple lines by using quotes? If so, that limitation should not pose a problem on the import.

Barring that, there is no way to do a merge into a single database table of two separate halves of entire records. You could definitely create two separate tables and use the Primary key as the key in relationship fields to pull over the other values from the second table. Then you'd see all values in one database, but couldn't change the related fields without following the relationship link to edit the record directly.

Another possibility (and probably how I'd do it) is to use Excel or OpenOffice's spreadsheet to copy the block of records from the one CSV into the cells of the other CSV. Then you'd have a single CSV file which you could then import. Seems worth this extra step to have it all as one file!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am


Return to HanDBase - Developers

Who is online

Users browsing this forum: No registered users and 0 guests