Jump to content

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

Recommended Posts

Posted (edited)

Hi all

If the users enters a year and week, I want to calculate the startdate and enddate of this year/week.

In another helpfile I found the following code:

Date(1;2 - DayofWeek(Date( 1; 0; Year(Get(CurrentDate))));Year(Get(CurrentDate))+ 7 * (Week - 1)

But that doesn't work. (I don't even know what it is trying to do).

Can anyone help me with this?

Thx

Sabrina

Edited by Guest
Posted

The formula does work, but only when I use a OnObjectModify-script to calculate start/enddate of the week.

At first I had the formula in the database as a auto-enter calculated value of a date-field.

Why didn't it get triggered in the database?

I found out that nothing I entered (not even get(currentdate) in the database was executed.

When do these options get triggered in the database? I am confused now.

Sabrina

Posted

If the users enters a year and week, I want to calculate the startdate and enddate of this year/week.

In another helpfile I found the following code:

Date(1;2 - DayofWeek(Date( 1; 0; Year(Get(CurrentDate))));Year(Get(CurrentDate))+ 7 * (Week - 1)

Since the formula does not use a year parameter as input, it cannot produce the required result.

There are some questions here which need to be clarified:

1. What is the "week" that your users enter? Is it the same as Filemaker's WeekOfYear(), or is it perhaps using another method? How do your users know the week number to enter?

2. What is the purpose of this calculation?

Posted

As comment stated, you need to provide some additional information.

Why didn't it get triggered in the database?

I found out that nothing I entered (not even get(currentdate) in the database was executed.

When do these options get triggered in the database? I am confused now.

Auto Enter does not effect existing records.

Also, be sure that you have deselected the option "Do not replace existing value of field (if any)"

Posted

1. The week the user enters is a 2-digit number with a valuelist from 1-53.

2. The purpose is to get the startdate and enddate for the week the user enters. (The also enter the year which is a 4-digit number with a valuelist from 1990-2020 with possibility to edit more).

I need it for hour-registration purposes.

Posted

That doesn't answer my questions. How do they know which week number to pick?

I need it for hour-registration purposes.

That doesn't tell me anything.

As I hinted earlier, there are various methods to calculate the week-of-year from date; Filemaker alone has two functions for this, which together can produce 8 different results for the same given date. You cannot reverse the calculation without knowing what it was in the first place.

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