Question on dataport validation

jeffb_r4jeffb_r4 Member Posts: 34
Hi all.
I'm preparing a dataport to import sales order information from another system.
On the dataport import for the sales lines, I am validating the item no. (in the OnAfterImportRecord area) but when I do this, I lose the unit price information.
Can anyone advise on how I can validate the item number without losing the unit price information?
Thanks.

Comments

  • AdamRoueAdamRoue Member Posts: 1,283
    edited 2007-06-28
    Hi

    If you bring the price into a variable and then assign the variable to the unit price after the validation of the item it should work, so as an example:


    VALIDATE (Type, Type::Item);
    VALIDATE ("No.",ItemVarable);
    VALIDATE (Quantity, QtyVariable);
    "Sales Line"."Unit Price":=PriceVariable;
    VALIDATE ("Sales Line"."Unit Price");
    "Sales Line"."Unit Cost (LCY)":=CostVariable;
    VALIDATE ("Sales Line"."Unit Cost (LCY)");

    I believe this worked for me.
    The art of teaching is clarity and the art of learning is to listen
  • bbrownbbrown Member Posts: 3,268
    Validate it before you import the price. There are two possible approaches.

    1. Use the field validate property on the data port fields

    This requires that your data file list the fields in the order they need to be validated in.

    2. Import the price to a variable. Then assign it to the sales line after you validate the item no.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    edited 2007-06-28
    Validate the "No." first then put in your price.

    Note you can either use the CallFieldCalidate Boolean in the Field Designer of the Dataport insteasd of putting it on the trigger.

    Or better yet - Import all your data into Variables then you can map them to it's proper matching NAV field in the order that you want.

    This way you have total control of what gets imported & when and you have more control of the validation process.

    ex./
    Lets say I have 3 variables i created in View->Golbals
    v_Imported_No
    v_Imported_Qty
    v_Imported_Price


    I enter these fields in the View->Dataport Fields instead of using the lookup directly to the Navision Standard Fields. Once the import begind the info is now saved in these variables. now on the OnAfterImportRecord I can bring them in the order that I want.

    "Sales Line"."No." := v_Imported_No;
    "Sales Line".VALIDATE("No."); //Get this out of the way!!!!!!

    "Sales Line".Quantity := v_Imported_Qty;
    "Sales Line".VALIDATE(Quantity); //Have control of validation

    "Sales Line"."Unit Price" := v_Imported_Price; //put in the price at end to avoid changing

    this is the proper way
    VALIDATE ("No.",ItemVarable);
    but i wanted to lay it out in an easy to understand manner :mrgreen:
  • SavatageSavatage Member Posts: 7,142
    Looks like I typed in too much - before posting my answer - you guys are faster typists :lol:

    Spent too much time on my pretty colors
  • jeffb_r4jeffb_r4 Member Posts: 34
    Excellent suggestions all.
    Thanks very much for the help!! I think I'll be using the variables approach. I find that the field validate property is kind of flaky, and doesn't always work. Has anybody else found that?
Sign In or Register to comment.