Options

Display text in a blob field

nbangazanbangaza Member Posts: 30
edited 2011-12-23 in NAV Three Tier
Hi All,

I have text saved in a Blob field in a table. I would like to display the contents of the blob field(the text written on this field) in a report.

I have struggled with this, can anyone help?

Regards,

Q

Comments

  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    nbangaza wrote:
    Hi All,

    I have text saved in a Blob field in a table. I would like to display the contents of the blob field(the text written on this field) in a report.

    I have struggled with this, can anyone help?

    Regards,

    Q
    Maybe this could be useful.
    viewtopic.php?f=23&t=45307
    1. divide the blob into array elements
    2. in classic build a textbox for each element
    3. print each element in RTC either in one textbox or in many.
    ~Rik~
    It works as expected... More or Less...
  • Options
    deV.chdeV.ch Member Posts: 543
    It is possible to assign a textbox in a report to a blob field of a table. So i guess no arrays are needed because rdlc report can handle a large blob (text string) with no problems. You should be able to assign the blob field to a textbox, mabye you need to use Cstr() Function to get the text displayed.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    deV.ch wrote:
    It is possible to assign a textbox in a report to a blob field of a table. So i guess no arrays are needed because rdlc report can handle a large blob (text string) with no problems. You should be able to assign the blob field to a textbox, mabye you need to use Cstr() Function to get the text displayed.
    Have you already tested it? It would be great if it worked.
    ~Rik~
    It works as expected... More or Less...
  • Options
    deV.chdeV.ch Member Posts: 543
    I did some short testing but had no luck with the method i discribed, sorry for that... (But maybe there is a way of doing conversion from binary to text in rdlc)

    But i found another solution:

    Put this on the OnAfterGetRecord() Trigger of your Dataitem where you want to display the text.
    TempBlob.Blob.CREATEINSTREAM(IStream);
    StreamReader := StreamReader.StreamReader(IStream,TRUE);
    

    Variable:
    Name	DataType	Subtype	Length
    StreamReader	DotNet	'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.StreamReader
    

    I used TempBlob table for my tests but of course this works with any blob field.

    The last thing you need to do is using StreamReader.ReadToEnd() as SourceExpr of the textbox in the section designer.

    Keep in mind to use ISSERVICETIER for this code if it's a hybrid report (classic & rtc) and you need to set the visible property to false.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    deV.ch wrote:
    I did some short testing but had no luck with the method i discribed, sorry for that... (But maybe there is a way of doing conversion from binary to text in rdlc)

    But i found another solution:

    Put this on the OnAfterGetRecord() Trigger of your Dataitem where you want to display the text.
    TempBlob.Blob.CREATEINSTREAM(IStream);
    StreamReader := StreamReader.StreamReader(IStream,TRUE);
    

    Variable:
    Name	DataType	Subtype	Length
    StreamReader	DotNet	'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.StreamReader
    

    I used TempBlob table for my tests but of course this works with any blob field.

    The last thing you need to do is using StreamReader.ReadToEnd() as SourceExpr of the textbox in the section designer.

    Keep in mind to use ISSERVICETIER for this code if it's a hybrid report (classic & rtc) and you need to set the visible property to false.

    :thumbsup: good solution I hope to be able to test it soon.
    Thx for sharing deV.ch.
    ~Rik~
    It works as expected... More or Less...
Sign In or Register to comment.