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.
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
.
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?>
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.
You also need to add a control for your form to an interview screen. Ensure that the output file type is PDF.
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.
When prompted, click the form link.
The form is generated with the QR code.
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
Design an RTF template for a form
Review a form generated from an interview
Title image credit: Claudio Schwarz via Unsplash