poetnabotl Posted May 23, 2008 Share Posted May 23, 2008 I have a script... Enter Find Mode[] Enter Find Mode [] Set Field [Enrollment::current; 1] Set Field [Enrollment::dayOfWeek; $dayOfWeek] Perform Find [] Go to Layout ["attendance lookup" (Attendance)] Import Records [No dialog; "Filename.fp7"; Add; Mac Roman] Show All Records Is there a way to check to see if a record already exists before creating a new one? I've thought about an 'if' like: Perform Find[] Go to Layout ["attendance lookup" (Attendance)] If [Enrollment::studentID ≠ Attendance::studentID & Enrollment::classID ≠ Attendance::classID] Import Records [No dialog...etc. But, clearly, that doesn't work. Anyone have any suggestions? Do I want a loop? If backstory is needed, this thread explains what I'm doing: http://filemakertoday.com/com/showthread.php?t=17911 Link to comment Share on other sites More sharing options...
poetnabotl Posted May 23, 2008 Author Share Posted May 23, 2008 Well, I broke down and ended up going to the first record in the found set, the starting a loop that sets variables to the values in question, entering 'find mode', going to the layout that needs to be checked, entering in those variables, running the find, if there are no records in the found set, creating a new record, setting the required fields to the variables, then going to the first layout, going to next record, ending loop. Does that seem like the best way to do that? Link to comment Share on other sites More sharing options...
Techphan Posted May 23, 2008 Share Posted May 23, 2008 I am confused... why are you importing records? From where ("Filename.fp7")? It appears you want to check to see if a record exists before creating a new one. If so run a script and if you get an error message (no found records) than go to new record form Where does the import come from? Link to comment Share on other sites More sharing options...
poetnabotl Posted May 23, 2008 Author Share Posted May 23, 2008 Scripting it to find records and then, if "no records in found set", creating new record and then setting fields with variables is what I ended up doing. Seems to work fine. I was just wondering if there's a better way I should be doing it. I often feel like I'm patching the thing together with nails because I didn't know my toolbox had a screwgun in it. To use a mediocre metaphor. Link to comment Share on other sites More sharing options...
Recommended Posts