June 10, 201411 yr 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
June 10, 201411 yr 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 )
Create an account or sign in to comment