Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Error - The length of the string is 15 , but it must be less than or equal to 10

(0) ShareShare
ReportReport
Posted on by 3,027

Hi

  I am getting the above error in below code

IF "Detailed GST Ledger Entry"."Gen. Bus. Posting Group" = '' THEN BEGIN
  IF recLocation.GET("Detailed GST Ledger Entry"."Buyer/Seller Reg. No.") THEN
   CName := recLocation.Code;
END;


Thanks

*This post is locked for comments

  • mmv Profile Picture
    mmv 11,465 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    Has this query got any relation with your recent post of "Buyer Seller State Code in Detailed GST Ledger Entry"?

    If so, please use the same thread, instead of multiple questions on the same.

  • Verified answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    You need to write following code for getting location name. You are passing the wrong field.

    IF "Detailed GST Ledger Entry"."Gen. Bus. Posting Group" = '' THEN BEGIN

     IF recLocation.GET("Detailed GST Ledger Entry"."Location Code") THEN

      CName := recLocation.Code;

    END;

  • mmv Profile Picture
    mmv 11,465 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    The recLocation.GET uses the Primary Key of the Location table, which is 10 characters in length.  Your "Detailed GST Ledger Entry"."Buyer/Seller Reg. No." is more than 10 characters, so it's causing the error.

    As mentioned by Marcell, do you think "Buyer/Seller Reg. No." stores the Location Code?

  • Suggested answer
    Marcellus Profile Picture
    Marcellus 2,735 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    Hi Jsshivalik,

    I think your problem is with the recLocation.GET because the application is expecting a maximum 10 characters long Location Code and the Detailed GST Ledger Entry"."Buyer/Seller Reg. No." is 15 characters long.

    Are you sure this code is going to get you a location?

    Check this msdn article about GET: msdn.microsoft.com/.../dd301056(v=nav.90).aspx it's expecting values stored in the primary key fields.

    Also you should turn on the debugger and execute your code, it will help you pinpoint the problem.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,054 Super User 2024 Season 2 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    What is the length of variable CName?

    If it is 10 then increase to equal the length of location code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans