Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

First Time CF Creation- Creating a Date List

Featured Replies

  • Newbies

Good Afternoon Everyone,

 

I am junior developer that believes i have run into my first custom function problem.

 

I am looking to filter a portal of of dates and to do so I would like to use a drop down list of date range something like this

 

6/3/2011- 6/3/2012

6/3/2012 - 6/3/2013

6/3/2013- 11/20/2014

 

However this filter needs to be dynamic based on a members join date. In this case it is 6/3/2011.  The date ranges are 1 year based on that initial joining date till the final year is is less than a complete year and instead ends at the current date. I hope to be able to accomplish all this in a calculation field that uses a recursive FM custom function to keep things nice and tidy.  

 

Again my function parameter is going to be 1 field with a start date, and return value i would like to have a line separated date list till current date is reached, there will not be a set number of years or reoccurrence, this will be solely based on a join date could be 2- to over 25 years.  

 

Any help or guidance is appreciated on how to accomplish this.   :cool:

Try

// DateLines ( startDate ) =
Let ( [
  cd = Get ( CurrentDate ) ;
  end = Min ( Date ( Month ( startDate ) ; Day ( startDate ) ; Year ( startDate ) + 1 ) ; cd )
  ] ;
  Case (
  startDate <= cd ; 
  startDate & " - " & end & Case ( end < cd ; ¶ & DateLines ( end ) )
  )
)
I am looking to filter a portal of of dates and to do so I would like to use a drop down list of date range something like this

 

6/3/2011- 6/3/2012

6/3/2012 - 6/3/2013

6/3/2013- 11/20/2014

 

How exactly do you plan to use this result in order "to filter a portal of of dates"? Or even as a drop-down list?

  • Author
  • Newbies

eos! - thanks so much, worked like a charm  :laugh2: .  Now to disect it over the next few days to figure out how it works and learn from the pros.  

 

comment - i know it is a little complicated for display purposes. As filtering goes it looks like this

 

Let ( [

 
DateStart = GetAsDate ( LeftWords ( Members::membershipYearfilter ; 1 ) );
DateEnd = GetAsDate ( RightWords ( Members::membershipYearfilter ; 1 ) );
DateCheck = If( DateStart ≤  Members » Membership_Payments::DatePaid and Members » Membership_Payments::DatePaid  ≤  DateEnd ; 1 ; 0 )
 
] ;
 
Case ( IsEmpty ( Members::membershipYearfilter ) ; 1 ;
Datecheck = 1 ; 1 ; 
0 )
 
)

 

Thanks you guys so much, and let me know if you have any other suggestions. 

Thanks you guys so much, and let me know if you have any other suggestions. 

 

Let ( [
DateStart = GetAsDate ( LeftWords ( Members::membershipYearfilter ; 1 ) );
DateEnd = GetAsDate ( RightWords ( Members::membershipYearfilter ; 1 ) );
DateCheck = If( DateStart ≤  Members » Membership_Payments::DatePaid and Members » Membership_Payments::DatePaid  ≤  DateEnd ; 1 ; 0 )
] ;
Case ( IsEmpty ( Members::membershipYearfilter ) ; 1 ;
Datecheck = 1 ; 1 ; 
0 )
)

 

can be expressed more succinct as

Let ( [
  f = Members::membershipYearfilter ;
  paid = Membership_Payments::DatePaid ;
  start = GetAsDate ( LeftWords ( f ; 1 ) ) ;
  end = GetAsDate ( RightWords ( f ; 1 ) ) ;
  isCovered = start ≤ paid and paid ≤ end
  ] ;
  IsEmpty ( f ) or isCovered
)

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.