Solved RB5.1 SP3 Funny Input Variable behavior

Discussion forum about all things Report Builder (all versions).
Tauno

RB5.1 SP3 Funny Input Variable behavior

Post by Tauno » 08 Jul 2008, 15:09

Hi,

I have a question
I have a following procedure in my APP that reads picture from BMP file and then inserts it into report builder Variable (sPKKPilt) who is Object type.
it works fine in 3.1(shows the picture in the report) but in 5.1 it somehow seems like don't convert string into picture again. Ive tried to read the file with the SAL functions and Vis functions.
Is there changes to SalReportSetObjectVar with the use of unicode or is there change how RB works on the Variable

Code: Select all

!!CB!! 134
Function: AbfPicToReport
   Description: Accept a filename, report window handle and
         report object variable name and set that report object variable to the
         picture (a BMP) in the filename file.
   Returns
      Boolean:
   Parameters
      Window Handle: hWndRep
      String: sFileName
      String: sVariableName
   Static Variables
   Local variables
      Long String: sPicture
      Number: nPicLength
      File Handle: fhPictureFile
      Boolean: bRet
      Number: nAbi
   Actions
      !
      ! This function opens the file with the desired picture
              and reads the picture into a string, then passes that
              to the passed report variable.
      !
      If VisFileOpen( fhPictureFile, sFileName, OF_Read ) = VTERR_Ok
         Call SalStrSetBufferLength( sPicture, 65530 )
         Set nPicLength= VisFileRead( fhPictureFile, sPicture, 50000 )
         Call VisFileClose( fhPictureFile )
         ! Call SalFileOpen(fhPictureFile, sFileName, OF_Read)
         ! Set nPicLength = SalFileRead(fhPictureFile, sPicture, 50000)
         ! Call SalFileClose(fhPictureFile)
         !
         Set bRet = SalReportSetObjectVar( hWndRep, sVariableName, sPicture)
      Return bRet
code.JPG
RB5.1.jpg
You do not have the required permissions to view the files attached to this post.

Jean-Marc Gemperle

Re: RB5.1 SP3 Funny Input Variable behavior

Post by Jean-Marc Gemperle » 08 Jul 2008, 15:31

Hi Tauno,

A quick suggestion as I'm sure I was OK passing a picture to report builder using TD 5.1.
Can you change just as test matter VisFileOpen() to use SalFileOpen() instead and most importantly use the OF_Binary flag, first try with VisFileOpen() with OF_Binary and if that does not help then SalFileOpen() with OF_Binary. AFAIK know, recall, on top of my head :-) the behavior as changed with UNICODE now, if you open a file and do not specify OF_Binaryit is assumed to be text causing thus problems...

Please let me know if that does not help I have a further look

JM

Tauno

Re: RB5.1 SP3 Funny Input Variable behavior

Post by Tauno » 09 Jul 2008, 06:25

Hi,

Thank you very-very much JM. Adding OF_Binary flag really helped (i do the happy dance) :lol:
Next time 'i'll be much smarter. Learning every day.

Tauno

P.S. now if only i get the answer to TOM question, then i'll be one satisfied programmer :D

Jean-Marc Gemperle

Re: RB5.1 SP3 Funny Input Variable behavior

Post by Jean-Marc Gemperle » 09 Jul 2008, 11:28

Hi Tauno

Glad it worked for you. I recall some TOM thread and recall I have done some tests without reproducing the issue that was an issue where you had problem to import a file in the repository right?

JM

ivanlun

Re: RB5.1 SP3 Funny Input Variable behavior

Post by ivanlun » 25 Mar 2009, 02:30

Hello Guys,

thank you for your posts.

I had the same problem with TD 5.1 SP4.
Didn't find out why there has been printed only a big "B" instead of the picture i've been loading with SalFileOpen.

Using the OF_Binary flag is the solution!

This is an important issue that i think should be known to every one that migrates to TD 5.1+;
please add it in your documentation, help etc. that speaks about it.

Happy coding

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests