cancel
Showing results for 
Search instead for 
Did you mean: 

Impex Row syntax for CSV upload using Spring integration

former_member611299
Participant
0 Kudos

I am trying to write a Spring Integration batch process to upload CSV data using impex Header. But I am not finding any documentation which explain the impexRow syntax. I am trying to look at the samples from acceleratorservices but I have some queries regarding the syntax. Can you please provide your response and any links for documentation on how to write impexRow syntax.

First Example Header

INSERT Customer;uid[unique=true];$setName;title(code);$setPassword

ImpexRow ;{+0};{1} {2};{3};

Q1- Why there is no semicolon between {1} and {2}

Second example Insert stock

UPDATE Product;code[unique=true];@stock[translator=de.hybris.platform.acceleratorservices.dataimport.batch.stock.StockTranslator,adapter=stockImportAdapter];$catalogVersion

ImpexRow ;{+0};{+1}:{2}

Q2- Why there is a colon between {1} and {2}

Import media container

INSERT_UPDATE MediaContainer;qualifier[unique=true];medias(code, $catalogVersion);$catalogVersion

ImpexRow ;{1};/1200Wx1200H/{1},/515Wx515H/{1},/300Wx300H/{1},/96Wx96H/{1},/65Wx65H/{1},/30Wx30H/{1}

Q3- I can't find any documentation to explain the above syntax. Can any one please explain it ?

Accepted Solutions (1)

Accepted Solutions (1)

amitpanwar
Advisor
Advisor
0 Kudos

Ans 1 - The value assigned to the name would be a combination of second and third field's values from csv. For example: 1234,Manoj,Kumar,mr

would be equivalently converted to impex as:

INSERT Customer;uid[unique=true];$setName;title(code);$setPassword

;1234;;mr;

Ans -2 - This is to tell the stock availability in a particular warehouse for a product, so that a stock level can be created along with the product. The value before colon is the actual stock value and the value after the colon is the warehouse id. You can understand it in a similar was as we write a product identifier in the impex along with its catalog version separated by colon.

Ans 3 - This tells that, it creates a media container which will include the media of different sizes which were created with identifier with the size convention.

For example: Suppose you want to create product images of different sizes like 1200wx1200h, 515wx515h, etc, and the product id is 10001 then you would create the medias with the identifiers as: /1200Wx1200H/10001 and /515Wx515H/10001

Now the syntax above would create the media container with id as 10001 and it will associate the medias with it having the identifiers as: /1200Wx1200H/10001,/515Wx515H/10001,/300Wx300H/10001,/96Wx96H/10001,/65Wx65H/10001,/30Wx30H/10001
former_member611299
Participant
0 Kudos

Thank you Amit for the detailed answer. First two are now clear. Regarding the third one do you have any sample CSV file which shows how to upload data for this type of impexrow ?

I have one more syntax for media which I am not able to understand. I will paste in a different comment as the text limit is not allowing me to paste.

amitpanwar
Advisor
Advisor
0 Kudos

1. create a folder images inside the base folder. For example: $HYBRIS_DATA_DIR/acceleratorservices/import/master/electronics/images 2. Now create the following sub folders inside images folder:

  • 1200Wx1200H

  • 515Wx515H

  • 300Wx300H

  • 96Wx96H

  • 65Wx65H

  • 30Wx30H

3. Now place the images of respective sizes in these sub-folders. Make sure that each file has same name. For ex: test.jpg

4. Now create a file inside folder $HYBRIS_DATA_DIR/acceleratorservices/import/master/electronics with name as media-20140619-162300-234.csv with contents:

12345,test.jpg

Former Member
0 Kudos

Hi what is the meaning of + symbol

      <value>;{+0};{+1}:{2}</value>


I'm not getting exactly, can you please help me with this.

Thanks, Siva

Answers (1)

Answers (1)

Former Member
0 Kudos

https://wiki.hybris.com/display/accdoc/Data+Importing+Capability+in+the+Commerce+Accelerator

Q1 : because in the resulting impex, values from column 1 and 2 will be cat. ie: ;A;B; in the original CSV will become ;A B; in the resulting Impex (there's a space between {1} {2}, therefore, there will be a space between A B)

Q2: refer to impex syntax, when for one entry, you need to provide multiple keys, you separate them by ':'. Example, if you need to find a product by code and lets say, country: in the impex header you will have product(code,country(isocode)) and in the row, you will have MYCODE:FR

Q3: they just reuse multiple times the value from the 1st column of the CSV and then concatenate it with static values wich are prefixes for media formats
former_member611299
Participant
0 Kudos

Thank you Yann for the detailed answer. First two are now clear. Regarding the third one do you have any sample CSV file which shows how to upload data for this type of impexrow ?

Former Member
0 Kudos

Hi

what is the meaning of + symbol

         <value>;{+0};{+1}:{2}</value>

I'm not getting exactly, can you please help me with this.

Thanks, Siva

Former Member
0 Kudos

Hello Sivaprasad, '+' symbolizes mandatory check on that column.