Home > ERP, Technology > Solution: BI Publisher QR Codes

Solution: BI Publisher QR Codes

I saw a post on StackOverflow asking How to use variable in chart.apis.google link for QR Code and I was quite intrigued. I didn’t think it could be done at first. But then I figured it out.

I do know that BI Publisher has built in Chart support, so my first thought was to just use that. But BI Publisher charting cant generate QR Codes. None the less, I linked to BI Publisher Report Designers guide to explain those details if anyone stumbled upon this post looking for actual charts.

My second thought was to follow a blog entry that an Oracle developer posted about using QR Codes in BI Publisher. It mentioned making a java class, and using an IDAutomation QR Font. It was quite complex. This is probably the method to go after if you want all the data to remain internal to the Oracle server in the enterprises data-center. I posted the details to that too.

Finally, I remember using dynamic images at Emerson for insertion of Casting images into Work-orders/Shop-packets. I figured why not give it a shot. I created a quick XML test file, and a simple RTF file. I use the concat (concatenate) function in BI Publisher to combined the Google Charts API for QR codes and the variable I wanted encoded.

Test XML

<test_header>
<test_row>
<row_num>1</row_num>
<value>TESTA</value>
</test_row>
<test_row>
<row_num>2</row_num>
<value>TESTB</value>
</test_row>
</test_header>

Test RTF Template

RTF Template

RTF Template

Image ALT TEXT

url:{concat(‘https://chart.apis.google.com/chart?cht=qr&chs=500×500&choe=UTF-8&chld=H&chl=&#8217;,value)}

My first attempt failed because of a space in my test data. If you have spaces or special characters in the data you want encoded in the QR code, make sure you URL encode the data that you want to pass into the Google API URL. Oracle allows you to do this with the UTL_URL function.

Example use of UTL_URL.ESCAPE

select rownum row_num, utl_url.escape(record_value) value from test_table

Once I removed the space from my test data, it worked! I was shocked how easy it could be.

Test Output

PDF Output

PDF Output

Other Considerations

One last thing to note, if you expect this to work on your enterprise server/network/data-center, you’ll probably have to open up the firewall.

  1. Nadeem Abbasi
    October 8, 2020 at 1:20 AM

    hi ,
    I want to generate barcode using the same API discussed above, is it possible?

    • October 8, 2020 at 9:52 AM

      I’m not sure what you mean. If you want to generate a standard CODE 3of9, use a CODE 3of9 font, add to BI Publisher as an embedded font. There’s paid for and public fonts available on the internet.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: