Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Olympia, WA
    Posts
    1

    How to capture data and auto-create a blank record?

    This is giving me a royal brain hernia...

    We're planning to take inventory in our college library using barcode scanners. What I want to do is scan alphanumeric-based barcodes (M#####) one-at-a-time into a single field (named barcode), and have FM auto-create a new record after each barcode is scanned. (Note: the scanners are set up so they automatically append a carriage return after each barcode number.) So, what would ideally happen is I'd scan a barcode, FM records it and creates a new, blank record; scan a barcode, FM records it and creates a new, blank record, ad infinitum. We'll probably end up with around 10,000-15,000 records.

    I know it involves a loop function but I can't figure out how to key it so that when FM "sees" the carriage return it knows to create a new, blank record.

    Any ideas before the last few strands of my hair turns gray or falls out?

    Ciao, and thanks!

    Rich
    South Puget Sound Community College in
    lush, exotic, tropical Olympia, WA

  2. #2
    Join Date
    Dec 2002
    Location
    Lisbon
    Posts
    9

    Post Re: How to capture data and auto-create a blank record?

    Hi Rich,


    A good ideia would be to do it all in batches instead of just one book at a time.

    I've never worked with FM and barscanning together but if you manage to create a single FM, return delimited text, file with a bunch of your barcodes you are in business. Actually this script will also work with one record at a time. But you should grab a list of books, or make one as you go along, so you can capture loads of barcodes (and still know which book each barcode references ).

    So considering you have all the barcodes in a single FM field in an out of system PARENT file, like this:

    Barcode1
    barcode2
    ...
    barccoden

    All you have to do is create a CHILD file and a relation from Parent->to->Child, with Allow creation of related records Set On.
    This relation can be based on an simple field (with a constant in it) or a calculation.

    Relation
    k =:: k

    You need these fields in Parent:

    k(calculation=1)
    gWordCount(Global, Number)
    gLeftAllBarcodesCount(Global, Number)
    YourRecordWithAllBarcodes(Text)

    Put these fields in the Child File:
    k(Text)
    OneBarcodeRecord(Text)

    Know it's easy:

    Go back to Parent make a Portal to Child on the Portal put the child field OneBarcodeRecord.

    \\--------------
    Create the following script in Parent: "CreatChildBarcodes"

    Go to Layout [with Portal]
    Set Field[gWordCount, WordCount(YourRecordWithAllBarcodes)]
    Set Field[gLeftAllBarcodesCount, "1"]
    Loop
    Go to Portal Row[Last]
    Set Field[Relation::OneBarcodeRecord, MiddleWords(YourRecordWithOneFieldWithAllBarcodes; gLeftBarCodeCount; 1)
    Set Field[gLeftAllBarcodesCount, gLeftAllBarcodesCount + 1]
    Exit Loop If[gLeftAllBarcodesCount = gWordCount + 1]
    End Loop
    Go to Layout[original layout]

    \\--------------

    Don't Forget:
    The Relation must Allow creation of records
    The Script must run on the same layout as the portal (because of the "Go to Portal Row" step.

    Good Luck
    Bergson
    Last edited by Bergson; 12-19-02 at 16:44.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •