Thanks Mike.
Yes I ended up writing a perl program to construct a xml file for input
instead. I found that I only needed the id plus first and last name. I
needed a party record then a person record. That seemed to be enough to get
the records into ofbiz. But I will modify it to include your suggestions.

Shame about the id. It would be nice the Importing service could detect
that the existing records id was integer and auto populate/increment from
what was already there.

Is there a way from outside of Ofbiz that I can query the ids in a Ofbiz
table?
I only plan to use integers.

Then I can use perl to initiate that query and increment the id to begin
constructing the xml records.

Can I call a Ofbiz service from the outside of Ofbiz to import the data
automagically?
On 22/08/2015 1:34 AM, "Mike" <mz4whee...@gmail.com> wrote:

> You need more to import a person.
>
> Here is a "simple" example using "1000" as the primary key.  The "key" can
> be anything, including the last name, but needs to stay consistent.
>
> Order is critical.  I also use "1000" as the "sub-key" to other relations,
> like ContactMech.
>
> If you have to import many of these, create a program to read your CSV,
> output in the below format, and import.
>
> You can also write an external program (perl/shell) and directly write to
> the database (it can be done), you just need to create the database entries
> in the exact same order as below:  Example:
>
> 1) Create Party record
> 2) Create PartyGroup record
> 3) Create PartyRole record
> ... etc.
>
> There is no substitute for studying the ofbiz schema.  There are a LOT more
> possible relations for importing a person.  For example, the below
> "PartyRole" is set to "ACCOUNT", which is most likely incorrect for you.
> However, this should be enough to get you started.
>
> Mike
>
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-engine-xml>
>   <Party partyId="1000" partyTypeId="PARTY_GROUP"
> createdByUserLogin="admin" createdDate="2013-09-24 22:33:35"/>
>   <PartyGroup partyId="1000" groupName="1000 Electronics"
> createdStamp="2013-09-24 22:33:36"/>
>   <PartyRole partyId="1000" createdStamp="2013-09-24 22:33:36"
> roleTypeId="ACCOUNT"/>
>   <ContactMech contactMechId="1000_0" createdStamp="2013-09-24 22:33:36"
> contactMechTypeId="POSTAL_ADDRESS"/>
>   <PostalAddress contactMechId="1000_0" createdStamp="2013-09-24 22:33:36"
> toName="1000 Electronics" city="BayVille" postalCode="08721-1835"
> countryGeoId="USA" address1="1800 Smith Avenue" stateProvinceGeoId="NJ"/>
>   <PartyContactMech contactMechId="1000_0" createdStamp="2013-09-24
> 22:33:36" allowSolicitation="N" fromDate="2013-09-24 22:33:36"
> partyId="1000"/>
>   <PartyContactMechPurpose contactMechId="1000_0"
> contactMechPurposeTypeId="GENERAL_LOCATION" createdStamp="2013-09-24
> 22:33:36" fromDate="2013-09-24 22:33:36" partyId="1000"/>
>   <PartyContactMechPurpose contactMechId="1000_0"
> contactMechPurposeTypeId="PAYMENT_LOCATION" createdStamp="2013-09-24
> 22:33:36" fromDate="2013-09-24 22:33:36" partyId="1000"/>
>   <PartyContactMechPurpose contactMechId="1000_0"
> contactMechPurposeTypeId="BILLING_LOCATION" createdStamp="2013-09-24
> 22:33:36" fromDate="2013-09-24 22:33:36" partyId="1000"/>
>   <ContactMech contactMechId="1000_P" createdStamp="2013-09-24 22:33:36"
> contactMechTypeId="TELECOM_NUMBER"/>
>   <PartyContactMech contactMechId="1000_P" createdStamp="2013-09-24
> 22:33:36" allowSolicitation="N" fromDate="2013-09-24 22:33:36"
> partyId="1000"/>
>   <TelecomNumber contactMechId="1000_P" areaCode="800" countryCode="011"
> createdStamp="2013-09-24 22:33:36" contactNumber="527-3306"
> askForName="1000 Electronics"/>
>   <PartyContactMechPurpose contactMechId="1000_P"
> contactMechPurposeTypeId="PRIMARY_PHONE" createdStamp="2013-09-24 22:33:36"
> fromDate="2013-09-24 22:33:36" partyId="1000"/>
>   <ContactMech contactMechId="1000_F" createdStamp="2013-09-24 22:33:36"
> contactMechTypeId="TELECOM_NUMBER"/>
>   <PartyContactMech contactMechId="1000_F" createdStamp="2013-09-24
> 22:33:36" allowSolicitation="N" fromDate="2013-09-24 22:33:36"
> partyId="1000"/>
>   <TelecomNumber contactMechId="1000_F" areaCode="732" countryCode="011"
> createdStamp="2013-09-24 22:33:36" contactNumber="237-1000"/>
>   <PartyContactMechPurpose contactMechId="1000_F"
> contactMechPurposeTypeId="FAX_NUMBER" createdStamp="2013-09-24 22:33:36"
> fromDate="2013-09-24 22:33:36" partyId="1000"/>
>   <ContactMech contactMechId="1000_E" createdStamp="2013-09-24 22:33:36"
> infoString="exam...@example.com" contactMechTypeId="EMAIL_ADDRESS"/>
>   <PartyContactMech contactMechId="1000_E" createdStamp="2013-09-24
> 22:33:36" allowSolicitation="N" fromDate="2013-09-24 22:33:36"
> partyId="1000"/>
> </entity-engine-xml>
>
>
> On Thu, Aug 20, 2015 at 10:47 PM, Andrew Dent - CTCroydon <
> ad...@comptroub.com> wrote:
>
> > Hi
> >
> >
> >
> > I have a list of persons that I want to import into OfBiz using the Data
> > File tool
> >
> > I have two files, names.xsd and names.csv
> >
> > However when I try to use the Data File tool I get a FreeMarker template
> > error. How do I import a list of names?
> >
> > I am using OfBiz 14.12
> >
> >
> >
> > The names.csv contains the data like this
> >
> >
> >
> > Harry,Smith
> >
> >
> >
> > The names.xsd file looks like this
> >
> >
> >
> > contains
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> >
> > <data-files xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >
> >
> > xsi:noNamespaceSchemaLocation="
> http://ofbiz.apache.org/dtds/datafiles.xsd
> > ">
> >
> >     <data-file name="names" separator-style="delimited" type-code="text"
> > text-delimiter=",">
> >
> >         <record name="person">
> >
> >             <field name="firstName" type="String" postion="0"/>
> >
> >             <field name="lastName" type="String"  postion="1"/>
> >
> >         </record>
> >
> >     </data-file>
> >
> > </data-files>
> >
> >
> >
> > Regards
> >
> >
> >
> > Andrew Dent
> >
> >
> >
> >
>

Reply via email to