on ‎2018 Feb 23 12:55 PM
Hi All,
Im trying to insert value to address table using the below impex.
INSERT_UPDATE Address;owner;original;duplicate;appartment;building;cellphone;company;department;district;email;fax;firstname;lastname;middlename;middlename2;phone1;phone2;pobox;postalcode;region;streetname;streetnumber;title;town;gender;dateOfBirth[dateformat=yyyyMMddHHmmss];remarks;publicKey;url;shippingAddress;unloadingAddress;billingAddress;contactAddress;line1;line2; ;8796453612781;;false;;;;k;;k;;;k;k;;;5667575565;;;567567;;k;k;8796093120536;k;;;;;;false;false;true;false;;
Getting the below error
INSERT_UPDATE Address;owner;original;duplicate;appartment;building;cellphone;company;department;district;email;fax;firstname;lastname;middlename;middlename2;phone1;phone2;pobox;postalcode;region;streetname;streetnumber;title;town;gender;dateOfBirth[dateformat=yyyyMMddHHmmss];remarks;publicKey;url;shippingAddress;unloadingAddress;billingAddress;contactAddress;line1;line2;;# missing unique modifier inside '{0=INSERT_UPDATE Address, 1=owner, 2=original, 3=duplicate, 4=appartment, 5=building, 6=cellphone, 7=company, 8=department, 9=district, 10=email, 11=fax, 12=firstname, 13=lastname, 14=middlename, 15=middlename2, 16=phone1, 17=phone2, 18=pobox, 19=postalcode, 20=region, 21=streetname, 22=streetnumber, 23=title, 24=town, 25=gender, 26=dateOfBirth[dateformat=yyyyMMddHHmmss], 27=remarks, 28=publicKey, 29=url, 30=shippingAddress, 31=unloadingAddress, 32=billingAddress, 33=contactAddress, 34=line1, 35=line2}' - at least one attribute has to be declared as unique (attributename[unique=true]);# invalid item expression '# missing unique modifier inside '{0=INSERT_UPDATE Address, 1=owner, 2=original, 3=duplicate, 4=appartment, 5=building, 6=cellphone, 7=company, 8=department, 9=district, 10=email, 11=fax, 12=firstname, 13=lastname, 14=middlename, 15=middlename2, 16=phone1, 17=phone2, 18=pobox, 19=postalcode, 20=region, 21=streetname, 22=streetnumber, 23=title, 24=town, 25=gender, 26=dateOfBirth[dateformat=yyyyMMddHHmmss], 27=remarks, 28=publicKey, 29=url, 30=shippingAddress, 31=unloadingAddress, 32=billingAddress, 33=contactAddress, 34=line1, 35=line2}' - at least one attribute has to be declared as unique (attributename[unique=true])' - unexpected expression at 407 ,,,,missing unique modifier inside '{0=INSERT_UPDATE Address, 1=owner, 2=original, 3=duplicate, 4=appartment, 5=building, 6=cellphone, 7=company, 8=department, 9=district, 10=email, 11=fax, 12=firstname, 13=lastname, 14=middlename, 15=middlename2, 16=phone1, 17=phone2, 18=pobox, 19=postalcode, 20=region, 21=streetname, 22=streetnumber, 23=title, 24=town, 25=gender, 26=dateOfBirth[dateformat=yyyyMMddHHmmss], 27=remarks, 28=publicKey, 29=url, 30=shippingAddress, 31=unloadingAddress, 32=billingAddress, 33=contactAddress, 34=line1, 35=line2}' - at least one attribute has to be declared as unique (attributename[unique=true]), invalid item expression '# missing unique modifier inside '{0=INSERT_UPDATE Address, 1=owner, 2=original, 3=duplicate, 4=appartment, 5=building, 6=cellphone, 7=company, 8=department, 9=district, 10=email, 11=fax, 12=firstname, 13=lastname, 14=middlename, 15=middlename2, 16=phone1, 17=phone2, 18=pobox, 19=postalcode, 20=region, 21=streetname, 22=streetnumber, 23=title, 24=town, 25=gender, 26=dateOfBirth[dateformat=yyyyMMddHHmmss], 27=remarks, 28=publicKey, 29=url, 30=shippingAddress, 31=unloadingAddress, 32=billingAddress, 33=contactAddress, 34=line1, 35=line2}' - at least one attribute has to be declared as unique (attributename[unique=true])' - unexpected expression at 407;8796453612781;;false;;;;k;;k;;;k;k;;;5667575565;;;567567;;k;k;8796093120536;k;;;;;;false;false;true;false;;
I don't have any unique modifier since multiple addresses can be tagged to the same user. Can you please let me know how to import in this case ?
Request clarification before answering.
Hi @Divya
You see this error, because the impex operation is of type 'INSERT_UPDATE', in which case hybris tries to find one unique object which is already present (using the 'unique=true' modifier on attributes in the impex header) , and then update it otherwise creates a new one. In case of insert_update operation it is required to give at-least one unique modifier.
In your case, either you can change the impex operation to INSERT, and it will work. Its side effect is if impex is run multiple times, you will have multiple address objects with same details. So use this if it is only one time insert. For example:
INSERT_UPDATE Address;owner ;original;duplicate;appartment;building;cellphone;company;department;district;email;fax;firstname;lastname;middlename;middlename2;phone1 ;phone2;pobox;postalcode;region;streetname;streetnumber;title ;town;gender;dateOfBirth[dateformat=yyyyMMddHHmmss];remarks;publicKey;url;shippingAddress;unloadingAddress;billingAddress;contactAddress;line1;line2;
;8796453612781; ;false ; ; ; ;k ; ;k ; ; ;k ;k ; ; ;5667575565; ; ;567567 ; ;k ;k ;8796093120536;k ; ; ; ; ; ;false ;false ;true ;false ; ;
Other option is to provide [unique=true] modifier on most of attributes which when combined/used together will provide uniqueness, such that hybris find only 1 such object, when evaluating across all the defined attributes, and hybris can then update that particular address object.
As you are dealing with addresses, which as such don't have any necessary unique condition, you might as well go ahead and add [unique=true] to all attributes, when using INSERT_UPDATE. Then as a result, you can re-use this impex, again and again, and only when there is any change (in any of the attrbutes) in the address only then a new address object will be created.
INSERT_UPDATE Address;owner(Customer.PK)[unique=true];original[unique=true];duplicate[unique=true];appartment[unique=true];building[unique=true];cellphone[unique=true];company[unique=true];department[unique=true];district[unique=true];email[unique=true];fax[unique=true];firstname[unique=true];lastname[unique=true];middlename[unique=true];middlename2[unique=true];phone1[unique=true];phone2[unique=true];pobox[unique=true];postalcode[unique=true];region[unique=true];streetname[unique=true];streetnumber[unique=true];title[unique=true] ;town[unique=true];gender[unique=true];dateOfBirth[dateformat=yyyyMMddHHmmss][unique=true];remarks[unique=true];publicKey[unique=true];url[unique=true];shippingAddress[unique=true];unloadingAddress[unique=true];billingAddress[unique=true];contactAddress[unique=true];line1[unique=true];line2[unique=true];
;8961454964740 ; ;false ; ; ; ;k ; ;k ; ; ;k ;k ; ; ;5667575565; ; ;567567 ; ;k ;k ;;k ; ; ; ; ; ;false ;false ;true ;false ; ;
Hope this helps you !
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to ensure the uniqueness. If multiple addresses are addressed to the same user, then you need another field like pincode and/or street number with unique attribute as true.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.