Hi there
Is it possible to tackle this through JavaScript.
I tried to work up a simple example. Taking Richard's example of the following two tables:
1) Food items - one row per item. This includes a barcode, name of item and maybe some other items.
2) Food diary - one row per item consumed.
If I understand Richard correctly he wants to search in the Food Items directory for a specific item. If he finds one he wants to find details in the Food diary?
To model this I've created two tables:
1) Barcode Master - equivalent to Food items
2) Barcode Junior - equivalent to the diary.
There is some code at the bottom of the email. You need to add this to a trigger script in Barcode Master i.e from the library list screen:
1) Click on three buttons on top right
2) Click on scripts
3) Click on the + sign on the bottom right
4) Choose trigger
5) You need to choose an event - choose 'Creating an entry'.
6) You need to choose a phase - choose 'Opening an edit entry card'
7) Paste in the code
8) You might need to change the permissions. So click on the shield button, click on available libraries and chose Barcode Junior.
9) Click on OK and save the trigger.
Now go to the library list screen. I click on the barcode simple at the top and I am given three options:
1) Add
2) Bulk Add
3) Search
I click on search and this prompts my scanner software to scan the barcode I am interested in. It then lists all items which have that barcode - as the master file has one record per item it should only find one item.
Then click on the item which takes you into the create an entry event. This runs the trigger and saves the item name to Barcode Junior.
That's the idea, but there are a few buts:
1) This works on my Memento. Obviously it would need testing on other libraries.
2) At the moment it would save the entry each time you created a new record. Therefore you might need to create a prompt to ask people if they do actually want to save the item to the junior file.
3) It doesn't allow you to add in other fields to the junior file. There maybe a way to do this in JS.
Let me know if this is headed in the right direction. Happy to think about it some more, although I am still a relative JS newbie.
Chris
*************** Code ************************
message ('in barcode trigger');
var thisitem=entry().field("Item");
message (thisitem);
var ljun=libByName("Barcode Junior");
var ljunent=ljun.entries();
// message (ljun);
// message (ljunent);
// var addrecord=libByName("Filterhome");
var newentry= new Object();
newentry["Item"]=thisitem;
// newentry["Address"]=libent[ent].field("Address");
ljun.create(newentry);