Jump to content

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

Recommended Posts

Posted

I am making a patient visit database where each record has two important fields. I need to keep both fields in the same record as they are both associated with same visit date. I need to track the date each field is modified independently. I don't think I can use the modification date field as that would only tell me if either one was changed.

Any ideas are greatly appreciated

I am relatively new to developing databases and this site has been such a great resource thanks to all of you!!!

Posted

Hi kgasman,

There are several tricks you can use. What I use, using timestamps:

If you want to track changes to a field called TEXT and insert Modification Date in another field, create new standard date field (called TextChanged). Set it to Auto-Enter by calculation with this:

If ( text ; Get ( CurrentDate ) ; Get ( CurrentDate ) )

Be sure to unclick 'Do Not Replace' checkbox right under 'by calculation' in Auto-Enter tab. If you want it to begin tracking the field as soon as the record is created (even when text field is empty), unclick in calc box 'Do Not Evaluate if all Referenced Fields are Empty."

LaRetta

Posted

thanks for the response.

I am not sure I understand how the If statement works in this case. Does this give the current date only when the text changes or everytime the record is viewed. I only want to record when the text actually changes.

thanks again

Posted

I am sorry but I still do not quite get it. If the date field auto calculation is set to

If ( text ; Get ( CurrentDate ) ; Get ( CurrentDate ) ) doesn't this get evaluated as follows:

If field "text" is modified (true) then expression1 is assigned to the date field

If field "text" is not modified (false) then expression2 is assigned to the date field

Since in this case expression 1 and expression 2 are the same won't the date field always be given the new currentdate whether or not Field "text" has been modified.

I was trying to only change the date field if the text was modified

Posted

I was trying to only change the date field if the text was modified

Yep, third time you've mentioned it and we have taken your need into account. smirk.gif

Give it a try. The new date field will only change if the text itself changes. Auto-Enter (Do Not Replace) needs a trigger and that trigger is the data change itself. It's easier to see this in action using a Timestamp field (create a demo - only takes 3 seconds). Then, each time you change the text, the timestamp immediately changes. You can click into the field and back out - or move about the record or change other fields - and timestamp won't change. wink.gif

"If field "text" is modified (true) then expression1 is assigned to the date field."

Close. If() isn't asking if text is modified. Since there is no operator, If() simply IS.

"If field "text" is not modified (false) then expression2 is assigned to the date field"

Nope. 'Nothing' can't trigger ... only 'something' can. How would FM know it's NOT modified? Basically, the calculation is always true but it won't fire without a change to the field. If() and Case() produce null (blank the date field) if we didn't list it a second time. Help me out here, JT (or comment). Am I explaining it clearly enough? crazy.gif

Posted

The true result is only produced when the referenced text/number field is a non-zero number or a combination of non-zero integers, with or without text (at least in version 7). If the field is blank or filled with only text or zero, the false result is produced (as long as 'do not evaluate if all referenced fields are empty' is deselected, or there will be no result when the field is cleared).

If you think about it, it makes sense. If( 0; "something"; "something else" ) will always return "something else" because zero is NEVER true. The same goes for If( field ... ) when field is null or filled only with text, zeroes, or a combination of the two. So if you only had If( textfield; Get(CurrentDate) ), you would only see the date when textfield contained at least one non-zero integer.

You can see this for yourself by using If( textfield; Get(CurrentDate); Get(CurrentDate) + 1 ), deselecting 'do not evaluate if all referenced fields are empty', and entering a variety of values to test.

Note that some previous versions will return true if textfield starts with t, y, true, or yes, depending on one's language version. Version 7 appears to have eliminated this 'feature', for which I am grateful.

Posted

thank you all,

I think I get it. I will try your examples to better understand it. Sorry it so long to explain it to me

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