Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5383 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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!

Posted

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?

Posted

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.

Posted

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.

Posted

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.

Posted

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.

This topic is 5383 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.