OCR Field Type

Created by Anthony Young, Modified on Tue, 14 Jun, 2022 at 1:45 PM by Anthony Young


The OCR (Optical Character Recognition) Field type lets you convert written or printed information into text via your device's camera.


This premium feature allows a user to capture or upload an image and rapidly convert any text found in the image into raw text or JSON response.


  • Setting up an OCR Field
  • Result Examples
    • Raw Text
    • Raw JSON


Note, the OCR field requires an internet connection to return image text.



Setting up an OCR Field

After creating a new Form screen, you will be taken to the Form Designer screen. The Form Designer screen provides a visual view of your Form, as well as a drag and drop approach for creating your Form design. 

Along the left section of the Designer, you will find a column of Basic and Advanced Field types.


The OCR Field can be found under our Advanced Field types.



Unique properties specific to the OCR field are:



Result Mode

  • Raw Text
    When this option is chosen, the raw text (extracted from the image) result will be displayed.
  • JSON
    When this option is chosen, the full OCR JSON response will be available in other fields via the JSONVAL() formula.

    For more information on JSON formula, please review Formula Cheat Sheet - Data Interchange.

On Capture Action

  • Define an action each time a successful OCR result is returned.



Result Examples


Raw Text

Image uploaded from device gallery.


Raw JSON

Image uploaded from device gallery.

The above image depicts a RAW JSON Results (Text field) with its dynamic value property being driven from the OCR Field - JSON Mode's (OCR field) dataname.


Form Designer Build:

The JSON result can be processed using JSON Path Syntax.


JSON Result (full)

{    "version": "3.2.0",    "modelVersion": "2021-04-12",    "readResults": [        {            "page": 1,            "angle": 12.5894,            "width": 800,            "height": 449,            "unit": "pixel",            "lines": [                {                    "boundingBox": [                        91,                        0,                        788,                        137,                        781,                        174,                        84,                        35                    ],                    "text": "Nutrition Facts Amount Per Serving",                    "appearance": {                        "style": {                            "name": "other",                            "confidence": 0.878                        }                    },                    "words": [                        {                            "boundingBox": [                                90,                                0,                                281,                                34,                                274,                                70,                                84,                                36                            ],                            "text": "Nutrition",                            "confidence": 0.994                        },                        {                            "boundingBox": [                                300,                                38,                                429,                                64,                                422,                                98,                                293,                                73                            ],                            "text": "Facts",                            "confidence": 0.995                        },                        {                            "boundingBox": [                                460,                                70,                                585,                                98,                                577,                                130,                                453,                                104                            ],                            "text": "Amount",                            "confidence": 0.996                        },                        {                            "boundingBox": [                                592,                                99,                                650,                                113,                                643,                                144,                                584,                                131                            ],                            "text": "Per",                            "confidence": 0.997                        },                        {                            "boundingBox": [                                657,                                115,                                783,                                145,                                775,                                173,                                650,                                145                            ],                            "text": "Serving",                            "confidence": 0.996                        }                    ]                }            ]        }    ] }
HTML


JSON Result (retrieve all words text)


Syntax:

$.readResults[0].lines[*].words[*].text

[  "Nutrition",  "Facts",  "Amount",  "Per",  "Serving" ]
HTML

However, in a Text field's dynamic value, the above syntax would need to be used in junction with our JSON() function.


Formula:

SUBSTITUTE(STRING(JSONLIST({{myOCRfieldJSON }}, 'readResults[0].lines[*].words[*].text')) , '|' , '\n')


For more information on JSON formula, please review Formula Cheat Sheet - Data Interchange.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article