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.

  • Verified answer
    DAnny3211 Profile Picture
    11,427 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,191 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,191 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
    104,157 Super User 2026 Season 2 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 570 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 390 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 220 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans