error with bigtext in report

kanikakanika Member Posts: 247
Hello experts!! NAV2018

I need to print the value of the work description field in sales header, for what I did this code where TextoStreamin(Text,1024):

"Sales Invoice Header".CALCFIELDS("Work Description");
IF "Sales Invoice Header"."Work Description".HASVALUE THEN BEGIN
"Sales Invoice Header"."Work Description".CREATEINSTREAM(Streamin,TEXTENCODING::Windows);
Streamin.READ(TextoStreamin);

but when the value exceeds 1024 characters is cut, I replaced the text variable with a bigtext like this, where btWorkDescription(bigtext)

CLEAR(btWorkDescription);
"Sales Invoice Header".CALCFIELDS("Work Description");
IF "Sales Invoice Header"."Work Description".HASVALUE THEN BEGIN
"Sales Invoice Header"."Work Description".CREATEINSTREAM(Streamin,TEXTENCODING::Windows);
Streamin.READ(btWorkDescription);

but it gives an error


please help me and thanks!!

Best Answer

Answers

  • kanikakanika Member Posts: 247
    I do not know how, please explain to me.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    You do not need BigText.
    "Sales Invoice Header".CALCFIELDS("Work Description");
    TempBLOB.BLOB := "Sales Invoice Header"."Work Description";
    WorkDescriptionText := TempBLOB.ReadAsText('', TEXTENCODING::Windows);
    //or if your WorkDescriptionText is declared as text with some lenght:
    WorkDescriptionText := COPYSTR(
      TempBLOB.ReadAsText('', TEXTENCODING::Windows);
      1, MAXSTRLEN(WorkDescriptionText) );
    
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kanikakanika Member Posts: 247
    edited 2018-11-06
    What kind of variable is TempBLOB ?
    Blob type variables can not be defined in the report
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-11-06
    kanika wrote: »
    What kind of variable is TempBLOB ?
    fzln79hpa2gv.png
    kanika wrote: »
    Blob type variables can not be defined in the report
    uefbduwei5r3.png
    Apart from the screenshot from Report 206, which is somewhat irrelevant here - you are not supposed to pass a BLOB field, but the text extracted from it.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • kanikakanika Member Posts: 247
    record type variable, ok
  • kanikakanika Member Posts: 247
    edited 2018-12-03
    Slawek_Guzek Posts: 1,609Member
    2018-11-06
    You do not need BigText.
    "Sales Invoice Header".CALCFIELDS("Work Description");
    TempBLOB.BLOB := "Sales Invoice Header"."Work Description";
    WorkDescriptionText := TempBLOB.ReadAsText('', TEXTENCODING::Windows);
    //or if your WorkDescriptionText is declared as text with some lenght:
    WorkDescriptionText := COPYSTR(
    TempBLOB.ReadAsText('', TEXTENCODING::Windows);
    1, MAXSTRLEN(WorkDescriptionText) );

    Slawek_Guzek, your code works but does not respect paragraph breaks; this is the result with your code:


    3agkbovwy0m6.png

    and what I need is:

    ygqb989k14pa.png

    but that works with more than 1024 characters.




  • kanikakanika Member Posts: 247
    thanks, you're very kind.
Sign In or Register to comment.