Better Method to change to Unit Price?

slmaluwaslmaluwa Member Posts: 366
Hi all

We have NAV 4 SP3 with Native DB.

We have around 9,000 selling items in the Item Card and our selling unit price changes few times a year.
Currently, I have a DataPort to import a CSV file with "No." and "Unit Price" fields. No coding involved. Just plain simple Data Port. In this method, I think that NAV just take each line from the CSV file, find "No." and replaces BOTH fields. If a code is not found, it is created. Is this correct?

What would be most appropriate automated way of updating Unit Price?
If the code is not found, I don't want to create a new item. I just want to through an exception or warning message.

I am sure that I am not alone and many of you must have already been using better methods to change the prices frequenty.

Thank you in advance

Maluwa
"A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."

Answers

  • ara3nara3n Member Posts: 9,256
    You can use sales price worksheet.
    If you need a proper dataport let me know.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • slmaluwaslmaluwa Member Posts: 366
    hi Ara3n

    I sent you a PM for this dataport and no reply.
    Can you please share this data port with me?

    Regards

    Maluwa
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • ara3nara3n Member Posts: 9,256
    Here is the Dataport.
    OBJECT Dataport 50000 Example Import Price
    {
      OBJECT-PROPERTIES
      {
        Date=01/16/08;
        Time=[ 7:55:51 AM];
        Modified=Yes;
        Version List=MOD01;
      }
      PROPERTIES
      {
        FieldStartDelimiter=<None>;
        FieldEndDelimiter=<None>;
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            AutoSave=No;
            AutoUpdate=No;
            AutoReplace=No;
            DataItemTableView=SORTING(Number);
            OnBeforeImportRecord=BEGIN
                                   CLEAR(Column);
                                 END;
    
            OnAfterImportRecord=BEGIN
                                  FOR I := 1 TO ARRAYLEN(Column) DO BEGIN
                                   Column[I] := DELCHR(Column[I],'<>',' ');
                                  END;
    
                                  IF Item.GET(Column[1]) THEN BEGIN
                                     EVALUATE(Item."Unit Price",Column[2]);
                                     Item.VALIDATE("Unit Price");
                                     Item.MODIFY(TRUE);
                                  END;
                                END;
    
            OnPostDataItem=BEGIN
                             COMMIT;
                           END;
    
          }
          FIELDS
          {
            {      ;     ;Column[1]            }
            {      ;     ;Column[2]            }
            {      ;     ;Column[3]            }
            {      ;     ;Column[4]            }
            {      ;     ;Column[5]            }
            {      ;     ;Column[6]            }
            {      ;     ;Column[7]            }
            {      ;     ;Column[8]            }
            {      ;     ;Column[9]            }
            {      ;     ;Column[10]           }
            {      ;     ;Column[11]           }
            {      ;     ;Column[12]           }
            {      ;     ;Column[13]           }
            {      ;     ;Column[14]           }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          Column@1000000000 : ARRAY [50] OF Text[100];
          I@1000000001 : Integer;
          Item@1000000002 : Record 27;
    
        BEGIN
        END.
      }
    }
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • slmaluwaslmaluwa Member Posts: 366
    Thank you Rashed

    But, can you please explain a bit on how this works? and what format the price list file should be in?

    I try to export and it started to loop through a number in negative.

    Thank you

    Maluwa
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • ara3nara3n Member Posts: 9,256
    Yeah don't use the export.


    It's coma separate file with Item no as first column and Unit price as second column
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SavatageSavatage Member Posts: 7,142
    Report 794 Adjust Item Costs/Prices
    or
    Report 791 Suggest Item Price Changes
  • ara3nara3n Member Posts: 9,256
    The reason for the following code is to remove leading and trailing empty spaces.
    FOR I := 1 TO ARRAYLEN(Column) DO BEGIN
                   Column[I] := DELCHR(Column[I],'<>',' ');
              END;
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • slmaluwaslmaluwa Member Posts: 366
    hi Ara3n
    In this case, you have used this code to get the price (numbers without trailing spaces)
    When we modify it to process TEXT/Option fields, is it necessary to remove it?

    One other confusion is, when it comes Option field, i heard that NAV stores them as Numbers. But, when we import them from TEXT files, do we have to create them as TEXT (option Strings) or numbers?

    Thank you
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • ara3nara3n Member Posts: 9,256
    You can keep it for options. Keep the value as Text for options


    when you are populating the table, you need to evaluate it

    evaluate(Item."Costing Method",Dataitem[5]);
    item.validate(Item."Costing Method");
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.