Jump to content

Automatic Creation of New Records


This topic is 3209 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hello,

We have a simple Filemaker solution which tracks stock we order from suppliers (Item ID (unique Key), Description, Category, Invoice, Serial Number, Date, etc) which we used to track stock and print labels from. (Table: Stock Items)

I would like to make an improvement to this by adding a stock take functionality. As we barcode the items and print the Item ID I would like someone to be able to walk around the shop and scan each barcode and then we can generate reports from there. The barcode scanner is setup to add a carriage return at the end of the scan to move on to the next line.

I have setup a table called "Stocktake". We just want to enter the Item ID and then other fields can be looked up. (see attached screenshot).

The issue I have is that I struggle for FM to create new records. What I have setup is created a script which makes a new record, and sets the focus to the field Stocktake:Item_id

- New Record/Request
- Go to Field [Stocktake::Item_ID]

I have then added a trigger to the Item_ID field which on "OnObjectSave" runs this script.

I have two problems:

1. If I type in a stocknumber the record is entered into the table, the script runs (can check it using tools), a new record is created but when the script finishes the focus is not on the Item_ID field. In fact there is no field that has focus applied. However, if I manually click on "New Record", or manually run the script the focus is on the field Item_ID for entry for the next item.

2. I notice that the record only is recorded if I press "Enter" on my numeric keypad. If I press "Enter" on the main keyboard it will not save the record. I am aware that on a Mac these keys are treated differently. What do I need to configure here? The scanner we use for barcodes has been configured to add a carriage return but this appears to be the same one as the main enter key and does not enter records.

I must just be doing something simple wrong. If anyone could give me some guidance it would be greatly appreciated.


Platform is Filemaker 12 Advanced running on Windows.

Capture.JPG

Link to comment
Share on other sites

If you format the field to 'Go to next object using [x] Return [x] Enter' (under Inspector > Data > Behavior), then either Enter or Return will exit the field - allowing you to use OnObjectExit as the script trigger.

Alternatively (and IMHO preferably), you could use a looping script showing the field in a custom dialog. Both Enter and Return select the first (default) button.

Link to comment
Share on other sites

  • Newbies

Thanks for your quick response!

Your suggestion of moving to next object by enabling "Return" under the inspector worked.

However, if I run the script using OnObjectExit as the trigger it went into a never ending loop just creating records. Not sure why?

Doing some more research, I found that adding:

Exit Script [Result: False]

to my original script fixed it. There is an explanation at http://forums.filemaker.com/posts/87c74253ef which states:

Is this within a script performed by a script trigger? If so, that could explain it. The Exit Script [False] step cancels the pending event that fired the script trigger and might be an event that would otherwise put the cursor in a different location as it takes place after Go To Field.

You can look up "setting up script triggers" in FileMaker help to see a table of all triggers and which perform scripts before the triggering event and which perform them after the triggering event.

although how this relates to my script / layout I'm not entirely sure?

Best regards, JS

Link to comment
Share on other sites

This topic is 3209 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.