February 27, 201015 yr I need a script that will act as a counter when a button activates. Ideally, when the button is pressed the first time a 1 is entered, when pressed a second time a line return and a 2 is entered, ad infitum. Can anyone help me? TIA
February 27, 201015 yr This is certainly a new one! Gotta wonder what you're up to. But, to answer your question, if you're looking to increment and append to an existing list, attach this script to your button : Set Field [myCounterField; Let ( end = RightValues ( ThisMonth::Counter; 1); If ( IsEmpty( ThisMonth::Counter); 1; ThisMonth::Counter & ¶ & end +1 ) ) ] where myCounterField is a text field.
February 27, 201015 yr Author This is for a file where someone may bring in a cat for spaying or neutering. They want to keep track of how many tame cats they get versus feral ones, and they want to do that by pressing a button. Looks like either approach will work just fine. Thanks a lot!
February 27, 201015 yr Not the best approach. I'd create a log of cats, and a flag field, flag_isFeral. Then sum the flag. Aren't they logging the operation? Shouldn't this be data related to the operation?
February 27, 201015 yr I agree with Barbara: the big flaw of this method is that it cannot handle "Oops".
February 27, 201015 yr Author They have not asked for any part of their operations to be part of this yet, but I will explore that idea with them next week. For the time being I am using Michael Horak's log button idea, and that takes care of the OOPS problem. Thanks again for all your help.
February 27, 201015 yr But it's the button that cannot handle Oops: what are they supposed to do if they accidentally click twice? Or if they lose count and need to go back and reconstruct the chain of events? Any logging method should leave a trail.
February 27, 201015 yr Author You are right, of course - furthermore, and update of records triggers the darn thing too. I think I'd better think it out again. They are not interested (they say) in logging feral cats, only the tame ones (about 10% of the total brought in). They want to know how many tame cats are brought in by each person. You mention a log of cats, but I have no table for each cat, only for the persons who bring them in. Please bear in mind that I am still feeling my way from FMP 6, and may not get some of the concepts.
February 27, 201015 yr Author Now I really am feeling dumb! I simply put in a one step script to increment the counter each time someone brings in a tame cat. Please excuse me for wasting your time.
Create an account or sign in to comment