Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

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:

Posted

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 ) )
  )
)
Posted
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?

  • Newbies
Posted

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. 

Posted

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
)

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