Jump to content

Function with a loop, please help


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

Recommended Posts

Hi

 

im still a bit of a beginner with filemaker

 

i have been trying to figure this out but need a little help. 

 

I have this function

 

If
(GetAsDate ( Date1) - GetAsDate (  Date2 )  <  0 ;
 Date1 + 28 ;
 Date1
)

 

 

What i need is to turn it in to a loop

 

so that 28 is added to Date1 until Date1 is higher than Date2

 

I have tries and testes let function and loop,

 

if any one could help 

 

Many Thanks

 

Meir

 

 

Link to comment
Share on other sites

1. Filemaker calculations do not loop.

 

2. Since you have the Advanced version, you can write a custom function. A custom function can be recursive (i.e. it can call itself in a loop).

 

3. Looping is not required to solve the current problem. Try =

Let ( [
diff = Date2 - Date1 ;
periods = Ceiling ( diff / 28  )
] ;
Date1 + Case ( diff > 0 ; 28 * periods )
)

or, if you prefer =

Date1 + Max ( 28 * Ceiling ( ( Date2 - Date1 )  / 28  ) ; 0 )
  • Like 2
Link to comment
Share on other sites

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