February 26, 200223 yr Does anyone know of a way (or a work around) to calculate a field only one time? I really really don't want to use a script or a plugin. What I want is for a calculation to get performed when a different field changes. But I only want the calculation to get performed once. What I'm trying to do is have email get generated once a record has been modified one time. The record will get created via the web and then modified via the web. Once that modification has occurred the record won't be touched again. I'm using the SMTPit plug-in to send the mail. Any ideas? FTR, FMP 5.5 running on Win2k pro, with IIS running as a webserver. Thanks, Carrie
February 26, 200223 yr Off the top of my head (and I'm not familiar with web-based DBs, so...) Set up the field as an auto-calc field. Create a number field, disallow manual entry and hide it (we'll get back to it). Create a calc field that returns the text "recalculate" if the auto-calc field does not equal what the auto-calc should be (meaning that the field on which the calc is based has been modified), and if the number field is empty (told you we'd get back to it). Create a script & attach it to the calc field that recalculates the auto-calc field and sets the number field to equal "1" -- but only if the calc field isn't empty. Now, the first time you modify the "different field", the calc field shows the word "recalculate". Clicking on that field will recalculate the auto-calc field, and puts a "1" in the number field, preventing the calc field from ever showing a value again. It's not totally automatic, but it might do the trick.
February 26, 200223 yr Author quote: Create a script & attach it to the calc field that recalculates... What do you mean by "attach it to the calc field"?
February 26, 200223 yr Keeping in mind that I'm not familiar with FMP on the web... In non-web circumstances, you can make a button out of a field -- in layout mode, just click on the field and go to Format:Button.
February 27, 200223 yr Create a number field, "Email sent." Create a field that auto-enters the Mod. Date. Create a field that is the Creation Date. Create a field that is a calc: Creation Date = Mod. Date. Create a script that runs when the record is updated via the web, that checks first to see if Email sent = 1, if so do nothing, else if the calc = 0 (i.e. the dates are different), the script should send your email, and set Email sent to 1.
Create an account or sign in to comment