Jump to content

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

Recommended Posts

Posted

Hi, I have a database with a field called [status] which is a value list and one called [date] what i am trying to do is when status is selected I would like the date of when it was changed to appear in the date field.

Thanks for any help or advise.

Chris

IT Support

United Kingdom

Manchester

Posted

Despite you being from the wrong side of the Penines, here goes!!

I presume that you want the Date field to change only when Status is changed rather than when any field on the record is modified. If so:

DATE = If(Field,Status(CurrentDate),Status(CurrentDate))

Substitute Field with the name of your field that is going to change. In your case to 'Status' (which could get confusing!!!)

The result must be stored

Hope this helps

Posted

Make the status field a button which is defined to run a script which is defined to update the date in the date field. After you have made your selection from the value list your script will run. Be aware, though, that the script will run every time you click on the status field, even if the value of the field is not changed. If this will be a problem, a solution is to add a message to the script that asks whether or not you would like to update the date field. If not change has been made, the user can click "no" and exit the script.

Posted

Thanks for the help, but im still a bit confused as I have not got a great deal of knowledge with scriptmaker, Im not sure how to go about writing the script, would it be possible to describe what to do in a bit more detail?

Thanks for the help it's appriciated.

Chris

Posted

Just to show the we Yorkshire boys ain't as bad as you might think we are, in fact we are so generous that I have made a sample file that you can have from me if you request by email from:

[email protected]

Posted

I don't think your calc can work. As you have used the "If" condition you should have a logical or math operator somewhere. Your calc relies upon a "true" result, and evaluates to CurrentDate in both condition

Plus you can't compare the current content of a field with it previous content, as you've just changed it - and, therefore, lost your comparison point.

Sample file from

[email protected]

Posted

I'll describe the less complicated way. This script would run every time the status field is clicked, even if no changes are made. This script only needs one step.

Set Field["Date", "Status(Current Date)"]

"Date" represents your date field. After you have written this script, then define your status field as a button and tell the button to perform the script.

That will give you the basic functionality. Let me know if you want to idiot-proof it with the message.

Posted

Tom's calc will work because of the way Filemaker evaluates calculated fields. With a stored field, the formula will only be evaluated when one of the fields that it references changes. In this case it's the status field. In the 'If" function, it really doesn't matter whether it is interpreted as a true or false value, because in both cases the result is Status(CurrentDate). However, there is one suggestion that I would make. Check to see if the status field is empty before setting the date. Otherwise you will get a date entered in the field whenever you create a new record. I normally use the following formula:

Case(IsEmpty(status),"",Status(CurrentDate))

This will set the date when the status field first takes on a value, and then will update with the current date whenever the status field changes.

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