Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

  • 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!

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?

I agree with Barbara: the big flaw of this method is that it cannot handle "Oops".

  • 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.

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.

  • 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.

  • 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.