John Chamberlain Posted February 27, 2010 Posted February 27, 2010 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
comment Posted February 27, 2010 Posted February 27, 2010 Not sure why this would be needed, but... LogButton.fp7.zip
bcooney Posted February 27, 2010 Posted February 27, 2010 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.
John Chamberlain Posted February 27, 2010 Author Posted February 27, 2010 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!
bcooney Posted February 27, 2010 Posted February 27, 2010 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?
comment Posted February 27, 2010 Posted February 27, 2010 I agree with Barbara: the big flaw of this method is that it cannot handle "Oops".
John Chamberlain Posted February 27, 2010 Author Posted February 27, 2010 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.
comment Posted February 27, 2010 Posted February 27, 2010 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.
John Chamberlain Posted February 27, 2010 Author Posted February 27, 2010 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.
John Chamberlain Posted February 27, 2010 Author Posted February 27, 2010 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.
Recommended Posts
This topic is 5657 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