web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

The Length of the string is 1188 but it must be less than or equal to 1024

(0) ShareShare
ReportReport
Posted on by

I am trying to import a txt file and iam getting this error: The Length of the string is 1188 but it must be less than or equal to 1024

the field is of text and i have mentioned the size to [2000] but still shows this error!!

Any sugestion to solve this issue.

I have the same question (0)
  • Verified answer
    DAnny3211 Profile Picture
    11,421 Super User 2026 Season 1 on at

    hi

    but your string variable is how long?

    my guess is that you have some text variable set to 1024

    can you share the code?

    DAniele

  • Suggested answer
    Manan_Shah Profile Picture
    1,461 on at
  • Suggested answer
    pankaj.k Profile Picture
    1,020 on at

    Hi Zayn

    As per the Code and Text Data Type you can use Maximum :1024 Length.

    I suggest you create one more field so you can add more Data.

    Note: As per the Microsoft document they are working for the Code & Text Length 2048 but we don't have any idea when we get this new changes.

    https://learn.microsoft.com/en-us/business-applications-release-notes/april19/dynamics365-business-central/max-length-of-variable-length-table-fields-has-been-expanded

  • Suggested answer
    pankaj.k Profile Picture
    1,020 on at

    hi Sainudheen 


    As suggest my above Answer if you create 2 Field then also need to use CopyStr function so you can copy data as per length.

    For CopyStr function check  URL: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/text/text-copystr-method 

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,187 Moderator on at

    The best idea here would be to write the long text into a blob field instead of using a text variable or a text field.

    Maybe also a good idea to try to share your code, then it will be easier to assist you.

  • Community Member Profile Picture
    on at

    Thanks for the all the replies Now, iam trying to make my field into a blob data type and iam using standard method like how  work description works ,by creating two procedures

    in the table,

    procedure SetWorkDescription(newfield: Text)

       var

           OutStream: OutStream;

       begin

           Clear("myfield");

           "INTRA_NAME".CreateOutStream(OutStream, TEXTENCODING::UTF8);

           OutStream.WriteText(newfield);

           Modify();

       end;

       procedure GetWorkDescription() mynewfield: Text

       var

           TypeHelper: Codeunit "Type Helper";

           InStream: InStream;

       begin

            CalcFields("myfield");

           "INTRA_NAME".CreateInStream(InStream, TEXTENCODING::UTF8);

           exit(TypeHelper.TryReadAsTextWithSepAndFieldErrMsg(InStream, TypeHelper.LFSeparator(), FieldName("myfield")));

       end;

    here what happens is iam trying add the code into the xmlport and on

     trigger OnAfterGetRecord()

                   var

                   begin

                       myfield := GetWorkDescription()

                   end;

    but it shows error you cannot use your The name 'GetWorkDescription' does not exist in the current context, so iam really stuck now...

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,187 Moderator on at

    Can you please share the complete object?

    Use rich formatting there is a function for inserting code.

  • Community Member Profile Picture
    on at
    xmlport 50000 "Import"

    {
        Format = VariableText;
        Direction = Import;
        FieldDelimiter = '^';
        FieldSeparator = '§';
        TextEncoding = MSDOS;
        schema
        {
            textelement(Root)
            {
                tableelement(mytable; mytable)
                {

                    fieldelement(myfield; mytable.myfield)
                    {

                    }
                    trigger OnAfterGetRecord()
                    begin
                        mytable.myfield := Getnewfieldblob()
                    end;
                }

            }

        }
    }
    table 50011 MyTable
    {
        DataClassification = ToBeClassified;

        fields
        {
            field(1; MyField; blob)
            {
                DataClassification = ToBeClassified;

            }
        }

        procedure Setnewfieldblob(Newfield: Text)
        var
            OutStream: OutStream;
        begin
            Clear("MyField");
            "MyField".CreateOutStream(OutStream, TEXTENCODING::UTF8);
            OutStream.WriteText(Newfield);
            Modify();
        end;

        procedure Getnewfieldblob() new: Text
        var
            TypeHelper: Codeunit "Type Helper";
            InStream: InStream;
        begin
            CalcFields("MyField");
            "MyField".CreateInStream(InStream, TEXTENCODING::UTF8);
            exit(TypeHelper.TryReadAsTextWithSepAndFieldErrMsg(InStream, TypeHelper.LFSeparator(), FieldName("MyField")));
        end;



    }


    This is my code ,

  • Community Member Profile Picture
    on at

    here is my code  NorthW

  • Verified answer
    YUN ZHU Profile Picture
    100,998 Super User 2026 Season 1 on at

    Hi, I have done a similar process before, but when exporting, I hope it can give you some reference.

    https://yzhums.com/31902/

    Thanks.

    ZHU

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,002 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,255 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,217

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans