Creating an Expression to Limit the Data to the Bar-Coded Entry


Before you perform this task, you must have added the document property AppMachineReadableCode to the analysis for your data that contains a column of QR codes or bar codes, as described in the topic  Creating Bar Code Reading Capability.

In the next step, limit the data to show only the row that matches the scanned item.

To create an expression to limit to a bar code:

  1. On the Spotfire Analyst menu bar, click Data > Add calculated column.

  2. Add the following expression.

    If('${AppMachineReadableCode}' = '' or [barcode] = '${AppMachineReadableCode}', true, false).

  3. Provide a name, such as "IsBarCodeFiltered" and check to make sure the expression is of type Boolean.

  4. Save and close the dialog.

  5. Right-click the visualization, and from the menu, click Properties.

  6. In the Properties dialog, select Data.

  7. Scroll down to the box Limit data using expression and click Edit.

  8. In the Limit Data Using Expression dialog, select the column isBarCodeFiltered, and then click Insert Columns.

  9. Click OK to close and save the change, and then close the Properties dialog.

When the value of IsBarCodeFiltered is set to False, all data appears. When the data is scanned using the bar code scanner on an iOS device, IsBarCodeFiltered is set to True and the data is limited to display the entry corresponding to the bar code..

To test bar code filtering:

  1. From your iOS mobile device, open the analysis containing bar code scanning capability.

  2. Tap the bar code icon.

  3.  Scan the bar code (or QR code) of an item  that is listed in the data table.

The following image displays the table visualization after the barcode button has been pressed, the value of the code captured, and the corresponding data displayed.

 

 

Note: This analysis is for demonstration purposes and is not ideal for viewing on a small screen. For more information and advice on optimizing for a small-screen display, see the document Designing Spotfire Analytics for Small-Screen Display.

See also:

Barcode Scanning

Creating Bar Code Reading Capability