I recently worked on a project for a customer, and thought of this idea as well. I will explain the Idea, Design, and Results for this project. Perhaps you can modify the example to meet your needs. I like this one because it is very easy to setup :)
IDEA:
The idea was to have patrons walk up to a lone field user and hand over a unique coupon that would be scanned into a text field. To ensure the coupon had not been copied and redistributed, we needed a way to look at all the previously scanned coupons. Feel free to modify the data column names and add your own labels. You only need to maintain the same relationship outlined in this example.
DESIGN:
Start off by building your sub-form and then move on to your parent form.
Sub-form
Form Name: coupon_sub
Element 1 (Text): scan_coupon
Dynamic Value: scan_coupon=""
Smart Table Search: Table Name-(sub) Column Name-(scan_coupon)
Element 2 (Text): already_scanned
Dynamic Value: if (scan_coupon!="") {"Yes"}
Condition Value: false
Element 3 (Text): duplicate_coupon
Dynamic Value: sub.already_scanned
Condition Value: false
Element 4 (Label): duplicate_message
Element Label: This coupon has already been scanned for this event. Please hit cancel and try the scan again.
Input Properties: Required
Condition Value: duplicate_coupon=="Yes"
PLEASE NOTE:
***We need to use a "hidden feature" to make our label required. Labels do not support the required checkbox, so we first create this as a text field and mark the required checkbox. We then switch the input type to a LABEL. If the label is showing on the device because of a duplicate scan, that record will be saved as a draft (because the label is required and the user cannot interact to satisfy the requirement). If the label is hidden from the device view, then we can process our scanned record without a problem.***
Parent
Form Name: coupon_parent
Element 1 (Sub-form): coupons
Smart Paging (Link Mode-Multiple): coupon_sub
RESULTS:
When you open a new parent record on the device, you will see the sub-form element. Enter the sub-form and scan in your first coupon. The value will be populated in our text field scan_coupon and our smart table will run in the background. Since this is our first scan, it will not return anything. Tap "Done" which takes you back to the record view, and then tap the "+" button for the next scan. Scan the same barcode as before and the label duplicate_message will appear. If you tap "Done" a popup will appear telling you our label is required and save the record as a draft. It is better to cancel the record as soon as you see the label to avoid saving the bad scan as a draft record. After you hit cancel, tap the "+" button again to try a new scan. If you do save the bad scan as a draft record, you can just delete that record from the record view by swiping your finger across the record to delete it.
IMPROVEMENTS:I did not try to reset the scan within the subform. This would save the field user a few taps every time there is a duplicate scan. If anyone has any other modifications or improvements feel free to post them below.
Can't find what your looking for? Before submitting a request look here!
Comments
0 comments
Article is closed for comments.