Jump to content

Recommended Posts

Hi can anyone offer advise on the best practice to script a find function please?

I have a "expiry date field" e.g.: 12/03/2018 and would like to have a script that could show records that fall within 8 weeks before or after the expiry date.

Thank you 

Share this post


Link to post
Share on other sites

Use the Date( ) function to create dates 56 days before and after your expiry date, and use that in the Set Field script step. The Date( ) function takes care of months and years all by itself.

Enter Find Mode [ ]

Set Field [YourTable::ExpiryDate; Let( [~theDate = YourTable::ExpiryDate; ~start = Date(Month(~theDate); Day(~theDate)-56; Year(~theDate));  ~end = Date(Month(~theDate);Day(~theDate)+56; Year(~theDate)) ]; ~start & "..." & ~end )

Perform Find [ ]
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi becham,

I would do this with a Conditional Formatting if you only want to view them.

Example file shows two different colors, one for past and one for future of the target date. You could use the same color for both fields

AnyDate represents your date field (you mentioned in your post).

Flag.fmp12

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank You for the sample file Lee that helps me understand the options i have much better.

kind regards

Share this post


Link to post
Share on other sites

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


×

Important Information

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