%3 or %4 codes in document number not working on import?

kimdonahowerkimdonahower Member Posts: 9
I have a situation where the %3 or %4 codes (that you put in a document number in the general journal to show the current month number or name) aren't working when the journal entry is created by dataporting it in from a text file. They work just fine when typed directly into the journal, but when they are brought in by dataport, the line posts as 'description %4' rathen than 'description January' or suchlike. Anyone have any ideas? Thanks much!

Comments

  • kinekine Member Posts: 12,562
    It is standard functionality? I never heard about that... for me it looks like some modification, and you need to call VALIDATE on the field to expand the placeholders...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • themavethemave Member Posts: 1,058
    kine wrote:
    It is standard functionality? I never heard about that... for me it looks like some modification, and you need to call VALIDATE on the field to expand the placeholders...
    It is standard, been in Navision since version 2.0 when we started.

    You can create a document number formula with one of the following codes:

    Code
    Result:

    %1
    Current day (for example, Monday)

    %2
    Current week (for example, 52)

    %3
    Current month number (for example, 1)

    %4
    Current month name (for example, January)

    %5
    Current accounting period name (for example, January)


    Example:

    If the entry's document number will be "R (rent) + current month," enter "R%3" in the field. The document number for January will then be R1.

    If there is more than one line in the journal, the program will automatically retain the same number on subsequent lines until the balance for the journal is 0. The next consecutive number will then be entered on the next line.
  • kinekine Member Posts: 12,562
    Ah, yes, but it work only with recurring journal, not with standard one... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kimdonahowerkimdonahower Member Posts: 9
    Right, but back to my question :D -- when I enter it in the recurring journal manually, it works fine, but if I dataport the same info into the recurring journal, the %4 stays %4 after it's posted -- anyone have any idea why and how I can make it work on import like it works when manually entered? The journal entry looks just the same before it's posted, it's only after posting it that the manually entered one turns into the correct month but the imported one stays %4.

    Any ideas? Thanks!
  • themavethemave Member Posts: 1,058
    Right, but back to my question :D -- when I enter it in the recurring journal manually, it works fine, but if I dataport the same info into the recurring journal, the %4 stays %4 after it's posted -- anyone have any idea why and how I can make it work on import like it works when manually entered? The journal entry looks just the same before it's posted, it's only after posting it that the manually entered one turns into the correct month but the imported one stays %4.

    Any ideas? Thanks!
    Here is a wild guess, it doesn't look exactly the same, my guess is the

    'description %4'

    has a leading charater so navision is treating the whole 'description %4' as one item, and not breaking it up.
  • kinekine Member Posts: 12,562
    The code making that document no. is this (taken from older NAV):
    WITH GenJnlLine2 DO BEGIN
      IF ("Account No." <> '') AND ("Recurring Method" <> 0) THEN BEGIN
        Day := DATE2DMY("Posting Date",1);
        Week := DATE2DWY("Posting Date",2);
        Month := DATE2DMY("Posting Date",2);
        MonthText := FORMAT("Posting Date",0,Text024);
        AccountingPeriod.SETRANGE("Starting Date",0D,"Posting Date");
        IF NOT AccountingPeriod.FIND('+') THEN
          AccountingPeriod.Name := '';
        "Document No." :=
          DELCHR(
            PADSTR(
              STRSUBSTNO("Document No.",Day,Week,Month,MonthText,AccountingPeriod.Name),
              MAXSTRLEN("Document No.")),
            '>');
        Description :=
          DELCHR(
            PADSTR(
              STRSUBSTNO(Description,Day,Week,Month,MonthText,AccountingPeriod.Name),
              MAXSTRLEN(Description)),
            '>');
      END;
    END;
    

    It means - no condition about what is first character etc., only that the account No. must be filled in and the recurring method must be selected.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.