Jump to content
Sign in to follow this  
artfairs

Time stamps for separate layouts...

Recommended Posts

Hi there,

I'm a little stuck on this, I'm hoping someone can help.

Right now I have a "Created", "Modified" and "Modified by" field on each layout of my database. Each field has a timestamp, except for the modified by, which states the user's name.

What I would like is that each time a layout is modified (data is inputted or altered in a field), the timestamp for "modified" will update to the current date, and ONLY for that particular layout, not the entire record. How can I go about doing this? Right now these fields update automatically on each layout instead of updating separately.

Please let me know if I'm not being clear.

Share this post


Link to post
Share on other sites

Hi

each layout has an unique set of fields ( apart those 3 fields ) ?

Share this post


Link to post
Share on other sites

You'll need three additional fields, one for each layout. Say your modification timestamp is named ztsModified then those fields would be calculation fields:

Layout1Mod= Case(Get(LayoutName) = "Layout1"; ztsModified; Layout1Mod)

Share this post


Link to post
Share on other sites

Thank you so much for your quick response.

Hmmm..... I've copied and pasted what you've suggested. It gave me an error message of:

"Specified field can not be found."

This is what I'm using:

Layout1Mod= Case(Get([color:red]AFI Data Entry) = "Layout1"; [color:red]AFI Record Modified 01 Data Entry ; Layout1Mod)

The red is the name of my layout and the name of the modified timestamp field.

Let me know if you know what I'm doing wrong.

Thanks again.

Share this post


Link to post
Share on other sites

Yes, I've created a different field for each layout.

If each layout has unique field ( fields ) you can trash the field that auto-enter the modification timestamp.

Create a field ( for each layout ) that auto-enter this calc:

Let(

trigger = field1;

Get ( CurrentTimeStamp )

)

or this other calc:

Evaluate ( Quote ( Get ( CurrentTimeStamp ) ) ; [field1;field2;field3] )

where field1, field2 and field3 stay on an unique layout

Share this post


Link to post
Share on other sites

Lol. Ok...

A layout shows data from a Table Occurence. Data is NOT inherently layout specific, that's kind of the point of Filemaker. However, you can make things Layout specific. One way of doing that is using a calculation with the function Get(LayoutName) which returns the name of the current layout.

Let's try that calc again, but anytime I write "Your" in front of something that means use the names you're using, not the literal text. The three elements of this calc are:

1) YourLayout1ModifiedTimestampField is a field which will contain this calculation and give you the result you want.

2) YourLayout1Name is the first layout you want to create this for.

3) YourGeneralTimestampField is a field of type Timestamp with the auto-enter option of Modification Timestamp checked.

YourLayout1ModifiedTimestampField = Case(Get(LayoutName) = "YourLayout1Name"; YourGeneralTimestampField; YourLayout1ModifiedTimestampField)

What this calc does is check the name of the current layout and if it matches the name you've set for it, it returns the Modification timestamp field (which updates whenever a field is changed, regardless of the Layout).

Dani's solution may work, but if there's many fields on the layout, you'll have to list them separately for the trigger to work.

Share this post


Link to post
Share on other sites

The simple example is perfect. I needed it too and it is the way to go.

Share this post


Link to post
Share on other sites

I'm glad if it helps - but I also think there should be a warning label attached to this method. Data should not depend on the layout by which it is entered or viewed.

Share this post


Link to post
Share on other sites

This has proven helpful, thank you very much. One more thing, if I wanted the "Modified by" field to update along with the "Modified" field, would I just input the same calculation?

Let(

trigger = field1;

Get ( [color:red]CurrentTimeStamp )

)

But replace Get ([color:red]CurrentTimeStamp), with something else? If so, what would I replace it with precisely?

Thank you again for all your help and patience.

Let me know if I am not being clear.

Share this post


Link to post
Share on other sites

[color:red]Get(AccountName) will tell you who the current user is.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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