Problem with the limit of a text variable

AitorEGAitorEG Member Posts: 342
Hi everyone,

I have a small problem with a text variable in NAV. This text variable, is writen in a file with the "WRITE" method, and must be everyhing in the same line. The issue, is that this line has 1047 positions, and the text data type only allows 1024 positions.
The problem is that the "WRITE" function, inserts automatically the line break, so I can't divide the data into 2 text variables, and write them separately.
How would you solve this issue? Is there any way to not insert the line break when writing? Or, can I usea any other data typo to generate the line?

Thank you very much

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-09-08
    Put your text into BigText variable type, adding chunk by chunk using ADDTEXT, and then stream out the big variable into a file.

    This method has an opposite problem - it does not write any new lines. If you need some then you need to add new lines explicitely by appending a short text consisting of 0x0d and 0x0a characters in places where you want your linebreak.

    Slawek
    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
    On a second thought - you have posted your quesion in NAV Three Tier - NAV 2013+ does not have a limit on Text variable lenght, just leave the lenght on your text variable definition blank

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • vaprogvaprog Member Posts: 1,144
    Also, check out the OutStream data type. It does not add a line break on each write. Use an OutStream.WRITETEXT call without a parameter to actually write a line break. This way you likely don't even have to construct your line in a Text variable in the first place.
  • JuhlJuhl Member Posts: 724
    In 2009 and 2013 you can use Dotnet System.String instead of Nav Text datatype
    Follow me on my blog juhl.blog
  • jaclynjaclyn Member Posts: 56
    https://msdn.microsoft.com/en-us/library/dd338712.aspx
    Big Text Data Type
    Microsoft
    The maximum length of a Big Text variable is 2,147,483,647 characters and this corresponds to 2 GB.
    I hope it will help you in this scenario.
  • AitorEGAitorEG Member Posts: 342
    Thanks for the anserws, I will work on it!!
Sign In or Register to comment.