Barcode
The Barcode control allows you to capture barcodes in a form when using the K2 Workspace (Mobile) app. You must configure this control when you're designing the form and configure rules to handle the events and data captured using the control. For general information about barcodes, see https://en.wikipedia.org/wiki/Barcode
The control is not a display control and is not shown at runtime on the form. When using the form, you'll click a button or take some other action to scan a barcode, and the resulting data is transferred to a text box or similar control. At design time, you see a visual representation of the control that you can configure.
See How To: Create a Mobile Form with a Barcode Control for detailed information about configuring and using the Barcode control on a mobile device.
The control is available in the Input section of the Toolbox
Property | Description | Can be set at runtime using rules? |
---|---|---|
Detail | ||
Name | A unique identifier for the selected control. This property is required and defaults to the name of the control. | No |
Is Supported | A value indicating if the device is supported. This control is only available for use with the K2 Workspace (Mobile) app. It is a good idea to use a rule condition to check if the device is supported before continuing with any operations. This property can only be used to set properties of other controls. | No |
Barcode | ||
Value | The value of the barcode. You can only use this property to set properties of other controls. | No |
The control interacts with other controls through rules. When you bind properties between different controls, you can use the data to populate properties or set values in runtime. Use the following examples for when to use the control with other controls through rules:
- Set a control’s properties - You can configure the settable properties of the control with this action
- Data Transfer - You can transfer data from items listed in the context browser to the control
- Execute a control's method - You can configure the control's method using this action
The following events and methods are available on the control.
Rule Events:
- When [control] is Changed: This event executes when the control is set to a new value that is different from the previous value. You can execute a rule condition or action when the control is changed, for example selecting an item or transferring a value to the control.
- When [control] is Error: You can execute a rule condition or action when the control is in error such as show a message, see Configure a Custom Error Rule for an example.
- When [control] is Initialized: You can execute a rule condition or action after the control has loaded, for example set the focus to the control. See How To: Use the Focus Control Method for an example.
- When [control] is Not Supported: You can execute a rule condition or action when the control is not supported, for example hide the scan barcode button and show a text box to enter barcode manually.
- When [control] is Scanned: You can execute a rule condition or action after the control has scanned, for example showing a message to the user after they scan a barcode.
- When [control] is Scanning: You can execute a rule condition or action when the control is scanning, for example if the form is offline, get confirmation from user before they scan a barcode.
Control Method:
- Execute a [control's] Scan method: Scans the barcode of an item
- The control is only available for use with the K2 Workspace (Mobile) app
- The control is not a display control
- The control is also available when you use forms
- You must configure rule events and actions to execute the control and do something with the data captured by the control
- K2 uses device-specific libraries to interpret barcodes, so the ability to read different formats depends on the formats that the device’s barcode libraries understand. See Machine Readable Object Types for iOS devices and Barcode API Overview for Android devices.