Dataports

LeshabelaLeshabela Member Posts: 35
hi, all.

i want to set a prices for customer, but when i import data from csv file to nav. nothing happens.
exported data on excel spreadsheet and saved it as csv from sales price table.

i'm i doing something wrong here.

the code


IF "Sales Price".GET("JNL Item No.","JNL Sales Type","JNL Sales Code","JNL Starting Date","JNL Currency Code",
"JNL Variant Code","JNL Unit of Measure Code","JNL Minimum Quantity") = FALSE THEN BEGIN

"Sales Price".INIT;
"Sales Price"."Item No." := "JNL Item No.";
"Sales Price"."Sales Type" := "JNL Sales Type";
"Sales Price"."Sales Code" := "JNL Sales Code";
"Sales Price"."Starting Date" := "JNL Starting Date";
"Sales Price"."Currency Code" := "JNL Currency Code";
"Sales Price"."Variant Code" := "JNL Variant Code";
"Sales Price"."Unit of Measure Code" := "JNL Unit of Measure Code";
"Sales Price"."Minimum Quantity" := "JNL Minimum Quantity";
"Sales Price".INSERT;
END;

//"Sales Price".VALIDATE("Sales Price"."Starting Date","JNL Starting Date");
"Sales Price".VALIDATE("Sales Price"."Ending Date","JNL Ending Date");
"Sales Price".VALIDATE("Sales Price"."Unit Price","JNL Unit Price");

the dataport runs through, but all the changes i made to the spreadsheet seems to be not impoted.

thanks in advance.
Learning Never End.

Comments

  • aleix1979aleix1979 Member Posts: 213
    If I'm not wrong you just want to import a single plain table. You don't need any code for that. Just declare in View->Dataport fiedls the incoming columns in the spread sheet.

    Code in the dataport is usually only used when you want to check any special value or importing an structure which merges several tables.
    Navision Developer
  • StephenGStephenG Member Posts: 99
    Leshabela wrote:
    hi, all.

    i want to set a prices for customer, but when i import data from csv file to nav. nothing happens.
    exported data on excel spreadsheet and saved it as csv from sales price table.

    i'm i doing something wrong here.

    the code


    IF "Sales Price".GET("JNL Item No.","JNL Sales Type","JNL Sales Code","JNL Starting Date","JNL Currency Code",
    "JNL Variant Code","JNL Unit of Measure Code","JNL Minimum Quantity") = FALSE THEN BEGIN

    "Sales Price".INIT;
    "Sales Price"."Item No." := "JNL Item No.";
    "Sales Price"."Sales Type" := "JNL Sales Type";
    "Sales Price"."Sales Code" := "JNL Sales Code";
    "Sales Price"."Starting Date" := "JNL Starting Date";
    "Sales Price"."Currency Code" := "JNL Currency Code";
    "Sales Price"."Variant Code" := "JNL Variant Code";
    "Sales Price"."Unit of Measure Code" := "JNL Unit of Measure Code";
    "Sales Price"."Minimum Quantity" := "JNL Minimum Quantity";
    "Sales Price".INSERT;
    END;

    //"Sales Price".VALIDATE("Sales Price"."Starting Date","JNL Starting Date");
    "Sales Price".VALIDATE("Sales Price"."Ending Date","JNL Ending Date");
    "Sales Price".VALIDATE("Sales Price"."Unit Price","JNL Unit Price");

    the dataport runs through, but all the changes i made to the spreadsheet seems to be not impoted.

    thanks in advance.


    According to the code you posted, after the two Validates you haven't coded a "Sales Price".MODIFY;
    Answer the question and wait for the answer.
  • LeshabelaLeshabela Member Posts: 35
    it is not just a plain table.
    i would like change prices for the specific customers, like customers whose sales code start with an E* set their prices for a specific all the item in the table. all the customers depending on the sales code will have a different price.

    hope i make sense.
    Learning Never End.
  • krikikriki Member, Moderator Posts: 9,118
    A few things to check:
    1) the code must be put in the "OnAfterImportRecord()"-trigger (advise to do a clear("Sales Price"); in "OnBeforeImportRecord()" and not in trigger "OnAfterImportRecord()".
    2) if you run the dataport in designmode (meaning not from the menu or Object Designer), at the end no COMMIT is done, so everything imports normally and is also put in the tables but without a COMMIT)
    3) if "Sales Price" is your dataitem, you clear the fields with "Sales Price".INIT; and then you do a few things, so they are always blank.
    4) if at a certain point, you don't want to import a record, you can do a "CurrDataport.skip;"
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.