How to rename an Item which consists a hidden character (ENTER)

elnowakoelnowako Member Posts: 12
edited 2018-04-27 in NAV Three Tier
Hi There,
NAV2013R2.
I have a few Items in my database where there are hidden characters stored in their codes.
When I am opening the Item Card i am getting an error message like this:
The record that you tried to open is not available. The page will close or show the next record.

Do you know how to rename such an Item? Or is there any way to get rid of this (ENTER) empty character from the Code?

Thank You in advance.

Answers

  • NavNabNavNab Member Posts: 181
    Hello,

    I believe the item was created outside NAV (by SQL directly) because in RTC you can't have hidden characters ;)

    So, I just tried what you described (i.e. create an item with TAB in its code) ==> I can open its card + I renamed it without any problem.

    Maybe the issue is that your Item No is lowercase?
  • elnowakoelnowako Member Posts: 12
    edited 2018-04-27
    Hi,

    Thanks for the answer.
    These Items have been created in NAV 5.0 by copy paste from Excel.
    And I think I made a mistake, this is hidden character is not a TAB it is more like ENTER.
    Then i made a conversion from 5.0 -> 2009 -> 2013 -> 2013R2.
    It is not possible to recreate such an Item in the RTC client, and probably because of that it is also not possible to rename/delete.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    If you copied it from Excel then it is likely a new line at the end of it (two characters 0x0d 0x0a). The issue with pasing data from Excel was present in NAV until late NAV2009R2 platform update.

    Try to create another item with the same code, and rename it instead. If it does not work you may be forced to rename Item in SQL - but it will be tricky


    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-04-27
    <DELETED>
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • NavNabNavNab Member Posts: 181
    Have you tried something like:
    CRLF[1] := 13;
    CRLF[2] := 10;
    
    CLEAR(Item);
    Item.SETFILTER("No.", '*' + CRLF + '*');
    IF Item.FINDSET THEN
      REPEAT
        Item2.GET(Item."No.");
        Item2.RENAME(DELCHR(Item2."No.", '=', CRLF));
      UNTIL Item.NEXT = 0;
    

    Where:
    eybw7oe7783g.png
  • elnowakoelnowako Member Posts: 12
    edited 2018-04-27
    It is not possible to Item.GET an Item if there is an ENTER inside of its code.
    This Code:
    Item2.GET(Item."No.");
    
    will always give an error.

    It seems like it is possible only via SQL.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Try:
    ...
      REPEAT
        Item2 := Item;
        Item2.RENAME(DELCHR(Item2."No.", '=', CRLF));
      UNTIL Item.NEXT = 0
    
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    or this:
    CRLF[1] := 13;
    CRLF[2] := 10;
    
    CLEAR(Item);
    Item.SETFILTER("No.", '*' + CRLF + '*');
    WHILE Item.FINDFIRST THEN
        Item.RENAME(DELCHR(Item."No.", '=', CRLF));
    
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • NavNabNavNab Member Posts: 181
    @Slawek_Guzek I'm afraid FINDFIRST will stuck also :neutral: (according to @elnowako )

    I would try RecRef.GETTABLE as it is not a read operation ?
    CLEAR(Item);
    Item.SETFILTER("No.", '*' + CRLF + '*');
    IF Item.FINDSET THEN
      REPEAT
        CLEAR(RecRef);
        RecRef.GETTABLE(Item);
        RecRef.RENAME(DELCHR(Item."No.", '=', CRLF));
        RecRef.CLOSE;
      UNTIL Item.NEXT = 0;
    

    @elnowako When you say:
    elnowako wrote: »
    will always give an error.

    You tried it or you're guessing?

    P.S: just trying to help ;)

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    NavNab wrote: »
    @Slawek_Guzek I'm afraid FINDFIRST will stuck also :neutral: (according to @elnowako )
    If FINDSET in a loop works (and it works otherwise Item.GET would not be executed and would not produce errors) then FINDFIRST will also work. The same filtering is used.

    The problem here is probably the assignment, stripping the non-printable characters. as the value is assignet to CODE type field, and the internal validations kicks in. Just like in case typing in a CODE field a value startting or ending with a space.

    It is easty to check with the following:
    CRLF[1] := 13;
    CRLF[2] := 10;
    
    CLEAR(Item);
    Item.SETFILTER("No.", '*' + CRLF + '*');
    IF Item.FINDSET THEN BEGIN
        Item2."No." := Item."No.";
        MESSAGE('Item 1: >>%1<<, Item 2: >>%<<', Item."No.", Item2."No.");
    END;
    
    If not this then it must be the GET stripping the white characters along the way

    The code with FINDFIRST avoids both.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • David_SingletonDavid_Singleton Member Posts: 5,479
    elnowako wrote: »
    Hi There,
    NAV2013R2.
    I have a few Items in my database where there are hidden characters stored in their codes.
    When I am opening the Item Card i am getting an error message like this:
    The record that you tried to open is not available. The page will close or show the next record.

    Do you know how to rename such an Item? Or is there any way to get rid of this (ENTER) empty character from the Code?

    Thank You in advance.

    I have seen this problem before, and fixing it in Navision is quite complex and slow. It is pretty simple (though tedious) to fix directly in SQL and a few orders of magnitude faster if you have a lot of items.
    David Singleton
Sign In or Register to comment.