Developer forum

Forum » Integration » Import specific csv rows to specific item fields in one item...

Import specific csv rows to specific item fields in one item...

Jacob Storgaard Jensen
Reply

Hi,

I've got these data:

 

And I need to import them to one item. Each row has to be imported to a specific item field.

I know this won't be searchable, but it's way easier to explain it in a video: http://screencast.com/t/MDZ6TsT9


Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

 

Option 1: Did you try to create a separate import job for each "Logger"?

 

 

Option 2: Use SQL Server to pivot the data (turn rows into columns)

 

You can do this by following these steps.

  1. Create a new job that imports the data from CSV directly as is to a "Loggers" table with the same columns.
  2. Create a view in the database that pivots the data in "Loggers" table (see below).
  3. Create a new job that imports the data to your item table from the view.
  4. Run the two jobs in sequence.

Example of how to pivot the data in SQL Server (change as needed):

SELECT [29020] AS Logger1, [29032] AS Logger2, [29044] AS Logger3, [29056] AS Logger4, [29068] AS Logger5, [29080] AS Logger6, [29092] AS Logger7
FROM Loggers
PIVOT
(SUM([Value]) FOR [ID] IN ([29020], [29032], [29044], [29056], [29068], [29080], [29092])) AS PivotTable;

Option 3: Transform into XML and use XSLT to pivot the data

  1. Create a new job that reads the data from CSV and exports as XML
  2. Create a new job that transforms the XML using XSLT (pivot) and imports the data to the item table.
  3. Run the two jobs in sequence.

 

Votes for this answer: 1

 

You must be logged in to post in the forum