I am trying to import lines from csv file to ax 2012 through code but in csv file one description column has multiple line.
Suppose one column has three lines so it is taking first line and insert it into dynamics table with values zero then second and third line it is creating with the all values 0 in all fields of second and third rows.
So is there any solutions for taking this three line as one line and import it into dynamics table so that it will import only one line.
Thanks in advance.
How are you importing the file? Through your custom code? Then modify your code to deal with this situation, e.g. checking if the line has an ID field filled in. Or you could replace in-field line breaks in the source file with some other separator and reconstruct line breaks during the import.
Thanx martin for reply.
I am inserting through custom code and my table has item id. Actually i am importing items and
scenario is when one row has item id and description field with more then one line so i have csv file
in that one row has description field with three line and when its import into one form according to description it is creating three line it should create one line based on item id so from the csv file it is taking first description and creating line with 0 values it is inserting item id and description apart from it it is inserting zero values adn left two lines in one column it is creating separate -separate lines with all zeros values.
Please give me solution for that.
Thanks and regards
Yes, I know. That’s why I suggested what I suggested.
Your code shouldn’t try to to insert such lines and you can easily fix it by checking if a mandatory column (such as an ID) is filled in. If it isn’t, it obviously isn’t a valid record and if there is something in description, it belongs to the previous line.
Line no Item number Description Quantity
1 Item1 Pen 3
Above is my csv file.
There is no any mandatory column in my table like ID as you told.
it simply imports line into one form which i have created.
After that it will create line in my original form. so problem is it is taking Pen as a first line.
Pencil is a second line and Book is a third line.
it should not take like that. It should take as one row together all items for Item1.
Thanks and regards.
If no column is mandatory, then lines two and three represents valid records and you don’t have enough information in your file to distinguish items with Description only and lines with Description belonging to another line.
I would rather assume that your statement if wrong and that each item must have an item number. Also the Line column seems to be a good candidate for item identification.
Martin as i have given that csv file in that only one row is there and in csv file enter description like
Pen then Alt+Enter then Pencil Alt+Enter then Book and all other information enter simply.
so here it should create line for item one with this three item description but here it is creating three lines. I don’t know I think it is taking Pen as line 1 Pencil as line 2 and Book as line three.
is there any solution to take this as one line. like we can take this pen pencil and book as one description.
Thanks and regards
Which part of the suggested solution isn’t clear to you?