Grouping 1 field after import from dataport

Hi all…

I just have issue about to import data (csv) to 1 table → table Transfer Line (5741)

so the data should be liket this

Location Code Item Code Quantity

BLUE Item A 1

BLUE Item B 3

BLUE Item C 2

RED Item A 10

RED Item B 9

RED Item C 4

and then I want to automatically create Transfer Header (5740) which is No. automatically get from No Series

for this example data… it should be 2 Transfer header records and 6 Transfer Line records

do you know how I create these?

thanks before

Hi

it is possible to create two TO-Header,i have below question to you

1.Why do you want to create 2 To headers with same lines ?

2.is your CSV have the requird fields to create TO headers ?

kindly give us more details or attach your CSV file

Thanks

jerome Marshal.J

Import lines to Transfer lines, then go through Transfer Line and create Records in Transfer Header table accordingly to your conditions.

I have one warehouse and then want to transfer item to every outlet

so I think I want to create it by transfer order…

we collect the data from barcode scanner,which is csv

so after I import it… the data will inserted to Tranfer Line

and grouping in Transfer Header

so we don’t need to input it manually to NAV

Hi Stan it is possible to achieve your requirement

Do the below steps

  1. Create a table (Example table1) it should contain all the fields which are mentioned in your CSV file with appropriate data type.

  2. Table1’s primary key must be contain following fields Location Code, Item No

  3. Create a data port (Example TO Import) with table1 as your data item

  4. Now Import all the records from your CSV to Table1

  5. While import check for duplication based on primary key

  6. If duplication found add the quantity with existing record

  7. After successful import records in Table1 like below

Location Code Item Code Quantity

BLUE Item A 1

BLUE Item B 3

BLUE Item C 2

RED Item A 10

RED Item B 9

RED Item C 4

  1. Go to the design mode of the TO Import data port

  2. Create three record variables for the following tables Transfer Header, Transfer Line, Location Code (Example Transheader, TransLine, LocationCode)

  3. Write code at Table1- OnPostDataItem() as below

Location Code.reset;

If Location Code.find(‘-’) then

Begin

repeat

Table1.reset;

Table1.setrange(Tabl1.”Location Code”,LocationCode.Code);

If Table1.find(‘-’) then

Begin

{ here you create your transheader}

{here you filter your Transfer line table by newly created Transfer header No and insert the lines from Table1}

{After Successful insertion into Transfer line you have to deleted insered lines from Table1}

End;

Until LocationCode.nex = 0;t

End;

  1. The above solution will create one Transfer header per location code for example in step 8 you have two location codes (BLUE, RED)

  2. So that two transfer Headers will be created on is for Blue Location another one is for RED location (Example TO-001 and To-002)

  3. TO-001 will have the lines of blue location TO-002 will have the lines of Red Location

  4. So that each TO have 3 lines

thanks a lot Marshall

but I still confused about the code

Hi Stan

Where you get confused.

Thanks

Jerome Marshal.J

Begin

{ here you create your transheader}

{here you filter your Transfer line table by newly created Transfer header No and insert the lines from Table1}

{After Successful insertion into Transfer line you have to deleted insered lines from Table1}

End;

that is how I create transfer header

because I must no series for add new transfer header automatically every Location Code (Grouped)