Importing CSV Using CompanyDirectory

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
tom3hp
New Member
New Member
Posts: 6
Joined: Tue Aug 18, 2009 9:39 pm

Re: Importing CSV Using CompanyDirectory

Post by tom3hp »

Well I must have the csv file formatted incorrectly.  Tried too much now and have scrambled my brain -- so don't know where I've been anymore.. :)

Maybe I'll come to it with a flesh start another day. Irritating tho..

TomH
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

This should work..

Code: Select all

#COMPANY=C|company_name|address|telephone|fax|contact_email|website|details|status|latitude|longitude|hierarchy||
#CATEGORY=T|name
#HIERARCHY=H|long_name

C|"CompanyName"|"theaddress"|"01234567"|"01234567"|"test@email.com"|"www.website.com"|"CompanyDetails"|published|0|0||
Tested with both DOS and UNIX format

JanB
Last edited by janb on Wed May 19, 2010 11:26 pm, edited 1 time in total.
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

Sorry, forgot the category field...

Code: Select all

#COMPANY=C|company_name|address|telephone|fax|contact_email|website|details|status|latitude|longitude|hierarchy||CAT:Category1
#CATEGORY=T|name
#HIERARCHY=H|long_name

C|"CompanyName"|"theaddress"|"01234567"|"01234567"|"test@email.com"|"www.website.com"|"CompanyDetails"|published|0|0|||1
JanB
Last edited by janb on Wed May 19, 2010 11:27 pm, edited 1 time in total.
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

Hmm, discovered something..

Importing records when category don't exist and T|Category1 is specified creates the category but don't populate the category value even if 'Popuplate category values on import' is set to 'Yes'.

So it could be a good idea to pre-define categories...

The import file i used:

Code: Select all

#COMPANY=C|company_name|address|telephone|fax|contact_email|website|details|status|latitude|longitude|hierarchy||CAT:Category1
#CATEGORY=T|name
#HIERARCHY=H|long_name

T|Category1

C|"CompanyName1"|"theaddress"|"01234567"|"01234567"|"test@email.com"|"www.website.com"|"CompanyDetails"|published|0|0|||1
JanB
tom3hp
New Member
New Member
Posts: 6
Joined: Tue Aug 18, 2009 9:39 pm

Re: Importing CSV Using CompanyDirectory

Post by tom3hp »

:) Thanks much janB. Just tried it and working fine even with my 45 categories and 32 extra fields.


TomH

PS I predefined all my cats and additional fields.
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

Great :)

Don't forget to add [Solved] to the subject in your first post..

JanB
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

Don't forget to add [Solved] to the subject in your first post..
Sorry tom3hp, that one was for Charlie

JanB
Last edited by janb on Thu May 20, 2010 12:38 am, edited 1 time in total.
janb

Re: Importing CSV Using CompanyDirectory

Post by janb »

Just an update...

This is the full format of the import file with some examples for the different fields, categories and hierarchy.

Code: Select all

#COMPANY=C|company_name|address|telephone|fax|contact_email|website|details|status|latitude|longitude|hierarchy|FIELD:Field1|FIELD:Field2|FIELD:Field3|FIELD:Field4|CAT:Category1|CAT:Category2
#FIELDDEF=F|name|type|max_length|admin_only|public|dropdown_data
#CATEGORY=T|name
#HIERARCHY=H|long_name

F|Field1|textbox|255|0|1|
F|Field2|checkbox|255|0|1|
F|Field3|textarea|255|0|1|
F|Field4|dropdown|255|0|1|Option1=1^^Option2=2^^Option3=3^^Option4=4

T|Category1
T|Category2
H|Hierarchy1
H|Hierarchy2
H|"Hierarchy2 -%%- Hierarchy2-1"
H|"Hierarchy2 -%%- Hierarchy2-2"

C|"CompanyName"|"theaddress"|"01234567"|"01234567"|"test@email.com"|"www.website.com"|"CompanyDetails"|published|0|0|"Hierarchy2 -%%- Hierarchy2-1"|"DataField1"|true|"Data Field3"|"Option4"|1|1
There is a couple of bugs, but it's easy to take care of these until an update is available.

1. If Hierarchies, Categories and Field Definitions doesn't exist, values doesn't updates when importing.
Solution: Predefine all of them manually or run the import file without company data but with the first lines and all field definitions (F|, T| and H| lines). Then import company data but without field definitions.

2. When importing Hierarchies, edit one of them and save it to update the Hierarchy table before importing Company data.

JanB

BTW: This is a GREAT module!! Gonna use it a lot for several purpose after I discovered all the possibilities :)
Last edited by janb on Thu May 20, 2010 7:47 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”