Unanswered: 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!
South Puget Sound Community College in
lush, exotic, tropical Olympia, WA
Re: How to capture data and auto-create a blank record?
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:
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.
Put these fields in the Child File:
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"]
Go to Portal Row[Last]
Set Field[Relation::OneBarcodeRecord, MiddleWords(YourRecordWithOneFieldWithAllBarcodes; gLeftBarCodeCount; 1)
Set Field[gLeftAllBarcodesCount, gLeftAllBarcodesCount + 1]
Exit Loop If[gLeftAllBarcodesCount = gWordCount + 1]
Go to Layout[original layout]
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.