Looking for methods of adding records (new to filemaker)

Discussion created by madmike6537 on Feb 19, 2014
Latest reply on Feb 20, 2014 by CICT

Hello all,


I run into a common problem, and I would like to know how more experienced developers handle this.


The situation is this: I am in a layout and I need to add new records to a related table. In a lot of these situations, I dont necessarily want to show all the other records, I just want to add a new record with an "ADD" button or something. I have two options (that I know of):


#1. I can use a portal - simple, easy, and effective

With this method though, the problem I have is that if I dont want to show any records in the portal, I only want to use it to create new records, then I have to add a filter that will prevent it from showing records. Ok thats no problem, but then what happens is if the user accidently clicks outside the portal, it commits the record and then it disapears - possibly leaving it with missing information. The user doesnt understand why it disappeared. I need a way to prevent the commit from taking place possibly unless some parameter has been met I guess. I know I can run the callback OnRecordValidate(or something like that) but what do you normally use to check that its complete? Do you set some kind of global variable that changes to true when the user clicks a button?


#2. I can use a script. - again fairly easy and straight forward

The problem I find with this method is that, I have to store the information they are entering somewhere. So now on the table in which the context of the layout is, I have to add temp fields to store the entered data, then use that data to create the record in the other table, and then go back and wipe out that data when I return to the layout.


I am currently using option #2, but I just feel like there should be a way to use portals without the risk of the user accidently committing data. How do you handle this situation?