How do I link a barcode input to a calculation field?

Answered

I want to scan a barcode associated with a Part Number and used the calculation field to subtract the Part number from a constant to equal 0. Then set a condition that the field must equal 0 before the form is submitted.

1

Comments

1 comment
Date Votes

Please sign in to leave a comment.

  • Official comment

    Hi Sara,

    This is a great question! You can accomplish this by doing the following:


    1. Link your reference data file to the barcode field as you normally would. Set up reference data to apply to any related fields as normal.

    2. Add a number field (this can be done as 'read only' or even hidden on mobile, whichever you prefer). Now link the same reference data column to this field as you linked to the barcode field BUT also have this number field reference the screen that the barcode is on, as well as the barcode field itself. 

    3. Now, you can use this number field as part of any calculation in the app. 

    Pertaining to the part about the constant - I can see this being especially useful for validation if this is part of a hand-off process. If that's the case:

    4. Later in the app (after the supposed hand-off) repeat the process above through step 2. Ensure that Number field A references Barcode field A, and Number field B references Barcode field B.  

    5. Add a calculation field - and set Number field A to subtract from Number field B (or vice versa, either should work fine). 

    6. On a separate screen, add a number field and give it the "exact" same title as the calculation field in step 5. You should also make this field either hidden or read-only. Open the field's "More" settings, and in the box titled "Receipt Label" type in MIRROR. 

    7. Add two static text fields to this screen. In the first, type something along the lines of instructing the user to proceed to submit - add a field condition to this field and have it reference the number field we just set the MIRROR on, with the conditional value equal to 0.
    In the second, instruct users to stop and go back. For the condition on this field, set the conditional value to <not equal> to 0. 

    This won't technically prevent them from submitting the form - but they will clearly be able to see that the wrong item was scanned, and be able to go back and check their work. 

    (Edited )

Didn't find what you were looking for?

New post