4 Replies Latest reply on Mar 17, 2016 1:49 PM by mrochie

    Appending barcode scans to existing text in field

    jthulin

      I would like to be able to list multiple scanned barcode values via scans in a single text field. Of course, the first scan is easy via:

       

      Insert from Device [ Type: Bar Code ; Camera; Back; Resolution: Full ]

       

      But how to append subsequent scans to the same field (preferably separated with commas for readability)? I was playing with:

       

      Set Field [Table::Text Field ; Table::Text & ", "  & [what to put here?]]

       

      It won't take "Insert from Device..." Any suggestions? Maybe I don't even need to use Set Field?

       

      Thanks.

       

      Joe

       

      (I'm using FMA v.14.05 for Mac and FMS v.14.x)

        • 1. Re: Appending barcode scans to existing text in field
          jbante

          When you want to accumulate several of the same kind of thing, you're usually better off storing the data in separate records — perhaps child records of a single parent record — rather than aggregating everything in a single field. Can you describe why you want the scanned values to all appear in a single field?

           

          If it turns out that it really is the right thing to do, you could scan each barcode using Insert from Device into one field, then accumulate the scans into a separate field:

           

          Insert from Device [Table::scan...]

          Set Field [Table::combined; Table::combined & ", " & Table::scan]

          • 2. Re: Appending barcode scans to existing text in field
            mrochie

            We have a toggle on our scan file - single or batch. We choose batch our press check scans - typically 8-12 scans on a press sheet. Single is default and always creates a new record on scans, but for press sheets we like to have all results visible so we keep all in the same record.

             

            Set a variable of the current contents of the field first & also check to see if there are current contents in that field

             

            Set Variable [$previous ; Value: If ( IsEmpty ( Barcode Scanner::bc ) ; "" ; Barcode Scanner::bc & "¶" ) ]

             

            Perform the scan event, and set a variable $new to the result.

             

            Then you can combine the two variables in a Set Field step; $previous & $new.

             

            I also check to see which camera is the default but not necessary if you're always using just front or back.

             

            HTH,

             

            Tony

            • 3. Re: Appending barcode scans to existing text in field
              jthulin

              I was thinking of setting a variable originally, and I modified what you posted to end up with:

               

              If [ IsEmpty ( Table::Barcode ) ]

                Insert from Device [ Table::Barcode; Type: Bar Code; Camera: Back; Resolution: Full ]

              Else

                Set Variable [ $current; Value:Table::Barcode ]

                Insert from Device [ Table::Barcode; Type: Bar Code; Camera: Back; Resolution: Full]

                Set Variable [ $new; Value:$current & ", " & Table::Barcode ]

                Set Field [ Table::Barcode; $new ]

              End If

               

              There might be a more elegant way to do it, but this works great. Thanks!

              • 4. Re: Appending barcode scans to existing text in field
                mrochie

                Good stuff! Glad I could help~ T