Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blob Image on Report not picking the correct image

TinyNinja

Programmer
Oct 1, 2018
99
0
6
US
I need help with my Blob Image. I have Order Numbers that I'm creating Barcodes for and need to throw the correct barcode image on the correct order number report. In my testing, I have 3 orders and 3 different barcodes. When the reports get created, it only used barcode A for all 3 orders instead of matching each barcode with the correct order.

Any thoughts on solutions?

The setup
[img ]

The Entry code to grab the images
[img ]

The variable
[img ]

The picture
[img ]

Report 1
[img ]

Report 2
[img ]

Report 3
[img ]
 
Hi,

Specify Controls Source as: CreateImageOnFly(BARNAME).
Variable BlobImage can you drop and "On Entry" expression can you clear too.

[pre]
PROCEDURE CreateImageOnFly
LPARAM m.lbBARNAME
LOCAL m.loImage
m.loImage=CREATEOBJECT("Image")
m.loImage.PictureVal=m.lbBARNAME
RETURN loImage
ENDPROC
[/pre]

mJindrova
 
I'd say on entry doesn't happen as often as you think. To print something that changes with every record, well, use the expression. mJindrova has a good idea for that.

Microsft posted this KB for how to print blobs:

It's a bit involved to do it as they implemnented it with a reportlistener and its BeforeBand event, but look at the comment:

*--------------------------------
*-- There has to be some way of redrawing the
*-- picture in the IMAGE class as the record pointer
*-- in the report's driving cursor changes; it does not occur
*-- automatically. [highlight #FCE94F]This could be done by a UDF() in the PrintWhen[/highlight]
*-- of the OLE Bound control on the report, or as is illustrated here,
*-- by a Report Listener BEFOREBAND() Event.

There's another idea to (mis) use the PrintWhen condition to update the image and have a simple static expression of the image object, which changes by PrintWhen.
Notice that variables you use in a report don't need to be created in the report variables section, it can be any local variable you define before running the report. The only advantage of variables created and updated by the report itself is encapsulation. The only real need is for calculation types other than none, though.

To clarify UDF is just meaning user define function. Can be anything that does something to the image variable and returns .T. in the end. So it could also be ýour EXECSCRIPT().



Chriss
 
I've made a big rookie mistake. I have be pointing at my first table I use rather than the view I created that is holding all the necessary info for the report. I finally realized it when I browsed the loops happening. Now that I'm pointing at the correct data the Picture & Blob methods both are working.

Hey mJindrova, Thank you for your suggestion and your code helped me realize my mistake.

Hey Chris, Thank you for linking to that article. I have saved it for future reference. Thank you for clarifying, it makes sense and has been helpful.

Hey mjcmkrsr, there isn't really any specific reason for the BLOB field. I had used it at my old job and figured it worked then so I should use it again. Thank you for your demo code, I have changed my code to point to the picture since the image looks crisper than the blob look.

I knew this problem had to be like 1 thing I was missing and ended up being the case. Thank you all! :)
 

Part and Inventory Search

Sponsor

Back
Top