This example demonstrates how to collect a URL in an Intelligent Advisor interview and generate a QR code for it in a PDF form. This could be used, for example, by a business to create a QR code sign in sheet for an event.

It is a quick and easy implementation that doesn’t involve any external fonts, nor an interview extension! We are using Oracle Policy Modeling 21C and Oracle Analytics Publisher Desktop 5.5.0. You can implement this functionality in your own project using the walkthrough below, or download the finished project to see it in action.

Let’s get started.

Create the attribute for the URL

Add a text attribute for the URL to your policy model.

A new Policy Modeling attribute for the URL

Note that the URL attribute (and any other attribute whose value you want to appear on the form) must have a name. For example, event_URL.

Add the QR code to the RTF form template

In your RTF form template, insert a field for the URL attribute. In the Field dialog, be sure to select the _value version of the attribute. For example, event_URL_value.

The _value version for an attribute in the field in a form template

Now you need to modify the code for the field. Double-click the field in the template to open the Oracle Analytics Publisher Properties dialog box. On the Advanced tab, modify the code to be in this format:

<?qrcode: attribute_name_value;size?>

where size is the QR code size dimension in points (pt).

For example, <?qrcode:event_URL_value;200?>

The code for a QR code in the properties for a field in a form template

Pro Tip! There are additional properties of the QR code, such as the error correction level, that you can include in the Analytics Publisher code. For more information, see 2D Barcode Functions.

Add the attribute and form to the interview

Next you need to add an input control for your URL attribute to an interview screen.

An input control for a URL attribute on an interview screen in Policy Modeling

You also need to add a control for your form to an interview screen. Ensure that the output file type is PDF.

A form control for a PDF form on an interview screen in Policy Modeling

Test the interview

You can test the generation of the QR code in the form using the Policy Modeling Debugger. In the interview enter a URL. The URL can, but doesn’t have to, include the http:// protocol. For example, https://www.oracle.com/events/ or www.oracle.com/events/ will both work.

A URL provided in an Intelligent Advisor interview

When prompted, click the form link.

A form link in an Intelligent Advisor interview

The form is generated with the QR code.

A generated form from an Intelligent Advisor interview showing a QR code created from the provided URL

When you scan the QR code with your mobile phone camera, the default browser will open the webpage using the URL provided in the interview. Try it yourself by scanning the QR code above!

Further information

If you would like further information on any of the concepts covered in this example, please visit these topics in the Intelligent Advisor Documentation Library:

Create a new attribute in Policy Modeling

Download Analytics Publisher

Design an RTF template for a form

Add forms to screens

Review a form generated from an interview

 

Title image credit: Claudio Schwarz via Unsplash