Newbies Hutch69 Posted July 12, 2011 Newbies Posted July 12, 2011 Just got up from the sword I fell on. New at FM. Writing a DB to barcode scan issued firearms and equipment for a duty shift - both in and out. Have a History table that records various things including the person issued to, time in and out and the equipment ID. Also have an equipment table that records items, serial numbers etc. The equipment table has a flag to record whether the item is in or out. My sign out script sets the flag to '1' by simply set field [Equipment::is_out; 1] I can't seem to manage to reset the flag to 0 upon equipment return. I need the flag to be in the equipment table as I use it to provide a count of items in and out to enable a shift handover. I guess the question is - when I change layouts to set a field - how can I navigate to the corresponding record to change the flag? I'm sure this is a simple to all you FM guru's out there!
bcooney Posted July 12, 2011 Posted July 12, 2011 The History table has an equipmentID, right? Create a relationship from History to Equip by EquipID. Then your "return" script can set the equip flag thru the relationship, without switching layouts. Set Field (history_Equip::is_out; "") //return or use GTRR History to Equip by EquipID and set the Equip field.
comment Posted July 12, 2011 Posted July 12, 2011 I would make the status field a calculation - eliminating the need to set the field, as well as a potential discrepancy.
Newbies Hutch69 Posted July 12, 2011 Author Newbies Posted July 12, 2011 bcooney - Wow - that worked. I think I had actually tried that previously but hadn't ticked the allow creation button. Many thanks. With reference to the comment of using a calculation for the status - can you give me an example? - It is current a number field with a value range of 0 or 1 All the time spent trying to nut this out - wish I'd found this Forum earlier.
comment Posted July 12, 2011 Posted July 12, 2011 using a calculation for the status - can you give me an example? Well, you could use = Count ( History::Out ) > Count ( History::In ) for example. If this is for display only, you don't even need that - see attached. LoanOut.zip
bcooney Posted July 13, 2011 Posted July 13, 2011 Allow Create does not need to be checked. However, comment's suggestion to calc the status is the ideal solution.
Newbies Hutch69 Posted August 2, 2011 Author Newbies Posted August 2, 2011 Wow - how simple. Will definitely make things easier, Cheers
Recommended Posts
This topic is 4881 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 accountSign in
Already have an account? Sign in here.
Sign In Now