Newbies armourer Posted December 9, 2020 Newbies Posted December 9, 2020 Hi everyone, This may seem pretty basic to most but I am a very new user. I have managed to create my asset database with the following fields: MAKE - TYPE - SERIAL NUMBER - SERVICE DATE I have scripted a button to enable me to click on a record in portal and update the service date to current date (pretty easy). What I would like is to be able to store each date the item was serviced and have a list of those dates appear inside a pop up when a SERVICE HISTORY button is pressed. I have been trying to script it so each time the SERVICE button is pressed it updates the SERVICE DATE field with current date and also stores that date is a corresponding field or another table, I just can't figure out how to do it. Any help greatly appreciated
comment Posted December 9, 2020 Posted December 9, 2020 I would suggest you use two tables: Assets and Maintenance, related by AssetID (or by serial number, assuming it is unique). Then have your script create a new related record in the Maintenance - something like: Set Variable [ $assetID; Assets::AssetID ] Go to Layout [ Maintenance ] New Record/Request Set Field [ Maintenance::AssetID; $assetID ] Set Field [ Maintenance::ServiceDate; Get ( CurrentDate ) ] Go to Layout [ original layout ] To protect against accidentally hitting the button twice, you could wrap this in: If [ Max ( Maintenance::MaintenanceDate ) < Get ( CurrentDate ) ] ... End If This ensures the correct data structure and enables you to build any user interface you want. For example, you can show the asset's service dates in a portal to the Maintenance table.
Newbies armourer Posted December 9, 2020 Author Newbies Posted December 9, 2020 Thank you for the reply So would this essentially create a new record in the maintenance table every time the service button is pressed? Then I could run a find to show all the records of that serial number in the maintenance table. I assume I would create the maintenance table with two fields - serial number and service date. Then connect with a relationship between the serial number field of both? Sorry again, I've only been playing with this for a day or so and am still getting to grips with how to link two tables. I also want to eventually record spare parts changed via a check box at service perhaps. Starting one step at a time. It's a lot to learn. Thanks again
comment Posted December 10, 2020 Posted December 10, 2020 (edited) 19 hours ago, armourer said: would this essentially create a new record in the maintenance table every time the service button is pressed? Yes. 19 hours ago, armourer said: Then I could run a find to show all the records of that serial number in the maintenance table. There is no need to "run a find". Use the relationship to access related records. If you like, you can think of a relationship as a kind of a "permanent find". To show related records, use a portal. Or, to show them in their own table, use the Go to Related Record[] script step to convert the related set to a found set. Edited December 10, 2020 by comment
Recommended Posts
This topic is 1442 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