How can i get the string exceeds the size 1024

Naidu.GNaidu.G Member Posts: 31
Hi All,

i am using file variable and i try to write the string exceeds the size 1024 it show the
error like " The length of the text string exceeds the size of the string buffer." . How can i
get the string into file.

My Code is like :----

FTxt.CREATE('C:\mail.txt');
FTxt.OPEN('C:\mail.txt');
FTxt.WRITEMODE(TRUE);
FTxt.WRITE(autOLMItem."To");
FTxt.CLOSE;






Thanks & Regrads,
Naidu.
](*,)

Comments

  • kinekine Member Posts: 12,562
    In this case I am using simple trick - I am working with variable defined as Char with dimension e.g. 5000. In this case you can create functions to work with this array of chars as with long string and write it into file char by char.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Naidu.GNaidu.G Member Posts: 31
    Hi kine,
    i am using the following automations

    Name DataType Subtype Length

    autOLAppl Automation 'Microsoft Outlook 12.0 Object Library'.Application
    autOLNamespace Automation 'Microsoft Outlook 12.0 Object Library'.NameSpace
    autOLItems Automation 'Microsoft Outlook 12.0 Object Library'.Items
    autOLMapiFolder Automation 'Microsoft Outlook 12.0 Object Library'.MAPIFolder
    autOLMItem Automation 'Microsoft Outlook 12.0 Object Library'.MailItem

    i wrote the code like this

    Contact.RESET;
    CLEAR(autOLAppl);
    CREATE(autOLAppl);
    autOLNamespace := autOLAppl.GetNamespace('MAPI');
    autOLNamespace.Logon('','',TRUE,FALSE);
    autOLMapiFolder := autOLNamespace.GetDefaultFolder(5);
    autOLItems := autOLMapiFolder.Items;
    i := 69;
    intEndOfLoop := autOLItems.Count;

    Total :=Contact.COUNT;
    W.OPEN('Contact No..#1##################\\' + Text001);

    WHILE i <= intEndOfLoop DO
    BEGIN
    X +=1;
    W.UPDATE(1,Contact."No.");
    W.UPDATE(2,X);
    W.UPDATE(3,Total);
    autOLMItem := autOLItems.Item(i);


    Contact.RESET;
    Rec."Synchronized Date" := autOLMItem.SentOn;


    IF autOLMItem.Size > 9999 THEN BEGIN
    MESSAGE('%1',autOLMItem.Size);

    FTxt.CREATE('C:\mail.txt');
    FTxt.OPEN('C:\mail.txt');
    FTxt.WRITE(autOLMItem."To");

    here i try to write the autOLMItem."To" into the file. But "To" string length is exceeds the 1024 so, it shows the error. Here how can i get char by char in to the character array.

    For Example we are having the file or string then we will get the char by char but it is the
    autOLMItem."To" ( automation dot property).

    Thanks & Regrads,
    Naidu. ](*,)
  • kinekine Member Posts: 12,562
    Ok, your first example was only about writing into file... now you want to pass the string into automation. There is no way around... you need to pass string, but string in NAV is only 1024bytes. Or, yes, there is way around - another external DLL which will do what you need. My coworker created such a dll, it means it is possible (pass the string from nav into this external component, it will create one big text string, and pass it into the automation you will pass to this component... something like that. But you need to understand how to do DLLs for NAV.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    Have you cosidered using BigText data type

    See JReynolds example in the post
    viewtopic.php?f=23&t=29313
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.