Jump to content
Server Maintenance This Week. ×

How to change value in field?


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

Recommended Posts

  • Newbies

If i have field with number.

How i can automatically make that number 1 smaller when i click Duplicate this record button?

So number is now 7 and in next record it is 6.

Link to comment
Share on other sites

We don't know if you are working with a sorted set nor whether the record being duplicated is the one 'last visited' or immediately prior so I would suggest, to expand on Tom's suggestion, that you use a script parameter.  Create a script named Duplicate record with these steps:

Set Variable [ $value ; yourFieldHoldingTheNumber ]
Duplicate Record
Set Field [ yourFieldReceivingTheNumber ; $value - 1 ]

Replace the 'yourField' portions of the above script with your actual field name (you can double-click it to insert it).  Then attach this script to a button called Duplicate Record.

And welcome to FMForums!  :-)

Edited by LaRetta
  • Like 1
Link to comment
Share on other sites

  • Newbies

I have never done anything this advanced.

Okay i have now managed to find Script Workspace and created script.

Now i can't figure out how to attach script to Duplicate button.

Thanks

Link to comment
Share on other sites

  1. Select the object which is your button.
  2. Right-click to bring up the field options.
  3. Select Button Setup.
  4. Select Perform Script and find your script in the list and select it.

There are a few cautions with your concept which I'll mention briefly: 

  • I don't know what you are doing but whether it is clearing month-end values, flagging records, or something else, you will want to include error trapping in case a record is locked and thus can't be modified. 
  • You've rated yourself as Beginner so I doubt you are running a standard Developer process such as synchronizing records.  I am concerned that your script suggests that you might be 'over-working' your data.

You have come to the right place for assistance to help you stay on track so your solution works well.  Let us know how it goes! :-)

Link to comment
Share on other sites

  • Newbies

It's just simple database with plain counter type of thing which is 1 smaller in next record.

"Select the object which is your button"

Button is Duplicate button in Status toolbar. So how i select this button?

Thanks again

Link to comment
Share on other sites

If you have FileMaker Pro Advanced, you can override the toolbar buttons via Custom Menus.

Or you can just make your own button on the layout.

Link to comment
Share on other sites

This topic is 2389 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.