Images In Reports

I was wondering how I could grab some QRCode images from my database and embed them in a report. Or, if there is some other way to get to what I want to do, that’s fine too. This is what I’m doing:

I’m using the QR Code Generator that Kyle Chase posted (thanks Kyle!), and I want to be able to dynamically create a bunch of them and allow my customer to print them out. I’m aware that I could put a certain number of them in a container and do a printToImage, but print quality seems better when I use reports, and gives me the ability to create headers and the such.

I see that there is a concept of image and image placeholders in the report viewer, but I’m not sure about how to use them. Should I create the QR codes and store them in my database as a blob, and then bind to them in the report viewer? Any other ideas?

Btw, I’m using Ignition 7.2.8.

If remember correctly, there is system.qr.generateQRCode(string,int) will generate the cuts for the qr image. You then write that to a dataset on the report and use an image on the report viewer. I’m mobile on vacation right now, but if it can wait,I can help more when I get back

Thanks Kyle, that’s good of you to post during vacation. I tried that function, and see the byte array. I’ll pester the others here now so you can get back to vacation. :slight_smile:

Travis (or whoever), I saw this in another thread: “The image place holder is only for displaying images that are literally stored in the dataset as a byte array. It doesn’t work for string image paths.” How do I store a byte array in the dataset? The output from the QRCode is array([-119, 80, … 66, 96, -126], byte)- what do I do with it now?

On the report, create a dataset. create as many rows as you need images. If you need 3 qrcodes on the same report, create 3 rows.

data = system.qr.generateQRCode("Code 1",256,256) dataset = event.source.qrDataset event.source.qrDataset = system.dataset.setValue(dataset,row,0,data

Thanks Kyle.

One question: what is the datatype of the destination dataset? I assume it must be string, and the system knows how to decode it again? I ended up with a dataset called “Barcodes” in the report designer with multiple rows, each with a single column of type String, with column name “Data”. Sound right?

And, looking at some other threads. I’m trying to figure out what this means:

[quote]
Since the image (byte array) is inside of the dataset you cannot create an image placeholder that points to “ImageObject.Data”. You have to drag the ImageObject dataset onto the report as a table. You can put the image placeholder in the details row of the table. You have to make the details row unstructured first. Once it is in the table it works just fine.[/quote]

So, I add a table to the report, make the details unstructured, and then click on “Data” and drag it to the details section? When I do that, all I can see is the literal string. If I use an Image Placeholder and point it to “Data”, I see nothing, and can’t tell if it’s something wrong with my datatype or how I’m doing it.

Thanks again for your help.

In order to display an image that comes from a dataset the data type of that column should be a byte array. So you need to create the dataset from scratch using system.dataset.toDataSet and Ignition will make that column a byte array if you send in one.