Skip 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.

??15 days from current date <//

Featured Replies

trying to create a find in a script that result in records are 15 days less than current date.

could on get all dates less than the current date /.

however could not figure out how to write it to only get records 15 days less than current date. Plz help

Unfortunately you can't do formulas in the Perform Find step, so you have to do it like this:

Enter Find Mode

Set Field [theDate ; Get(CurrentDate) - 15 ]

Perform Find

  • Author

thanks for the info, however i can't seem to make this work

  • Author

The below was what finally worked for me:

create field (calculation):

fieldname < Get(CurrentDate) -7

then ran find based on field

Just for your future information, it should have worked perfectly. If you are like me, I'd try to understand why it didn't work because understanding how to create date calculations to be used within Set Field[] is very useful AND Tom's method prevents the need for creating a calculation field (which wastes resources and bloats your field definitions).

Can you explain exactly what you tried? Because using Tom's script in a date field would indeed return records with a date exactly 15 days prior than today. We'll help you out if you wish! :wink2:

LaRetta

  • Author

My initial post was not very clear in retrospect.

What I was looking for was records 15 days or older than the current date.

If I can create a script that will accomplish the same result without the calculated field that would be great.

I ultimately made the calc for 7 days.

Edited by Guest

Yep, you can ditch the calculated field and handle it all within your script.

Enter Find Mode [ ] ... uncheck pause

Set Field [ yourDateField ; "<" & Get ( CurrentDate ) - 15 ]

Perform Find [ ]

:smile2:

  • Author

do i need to specify anything for "Enter Find Mode" or "Perform Find"?

"do i need to specify anything for "Enter Find Mode" or "Perform Find"?"

No. Do NOT select the option to restore find requests for either step.

My script calc didn't include the less-than symbol, because that's how I interpreted "only get records 15 days less than current date." You didn't specify how it failed, but maybe you didn't have any records that were exactly (date-15). Use LaRetta's version and make sure you've unchecked the Find options. I can send you a sample file if that still doesn't work.

  • Author

ok i must be doing something wrong, when i run the script it is still telling me no records found

Enter Find Mode [Pause]

set field [table::field [get(currentdate)<15]

Perform Find []

You are not following what was explained:

Enter Find Mode [ ] ... uncheck pause

Set Field [ yourDateField ; "<" & Get ( CurrentDate ) - 15 ]

Perform Find [ ]

Uncheck pause ... put the less than symbol before Get ( CurrentDate )

:smile2:

If you are doing that but just typed it incorrectly, then we need you to put very accurately what you are doing. Is that date field a true date field?

Set Field [] has two parts. The first part (Target Field) is where you select your date field. The second part (calculated result) is where you type into the calculation box. What you type into the calculation box would be only:

[color:green]"<" & Get ( CurrentDate ) - 15

Edited by Guest

  • Author

unchecked paused, still finding no records

Edited by Guest

Where? This makes no sense? In the calculation dialog? Grab what is in that calc box (copy it) and paste it directly here for us to see, please.

  • Author

fixed, but still no records found

You are going too fast and not providing enough information and you are changing your answers faster than I can respond. Can you post the file? Have you verified that records exist meeting the criteria, ie, that there are older than 9/4? Have you verified that it is a date field?

Copy and paste the exact syntax (what is in your calc box) directly here.

Have you made sure nothing is stored in your find request? Be sure both Enter Find Mode () and Perform Find() ... have nothing entered in their find requests.

  • Author

All good questions, the field has dates from early 2006 till now, and is formated as a date field.

Here is the exact syntax

CIA::CRTltrDate["<" & Get ( CurrentDate ) - 15]

I explained specifically what to put into that calculation dialog.

It was not: [color:blue]CIA::CRTltrDate["<" & Get ( CurrentDate ) - 15]

It was: [color:blue]"<" & Get ( CurrentDate ) - 15

I explained it above with:

The second part (calculated result) is where you type into the calculation box. What you type into the calculation box would be only:

[color:green]"<" & Get ( CurrentDate ) - 15

  • Author

how can i specify which field?

Above I explained it in detail:

Set Field [] has two parts. The first part (Target Field) is where you select your date field.

1) Select the Set Field[] script step by double-clicking until it pops into your script.

2) Immediately look to your right and it will say Specify target field.

3) click that word SPECIFY.

4) find your date field in the list.

5) double-click your field.

6) Then on calculation result, click SPECIFY. Type "<" & Get ( CurrentDate ) - 15

Follow this exactly - exactly. Step by step. :wink2:

  • Author

I got it...works great thanks for all!!

  • 1 year later...

Hi,

I was wondering if we can revisit this thread and expand the scope of the question? If I was to expand the calculation to include another argument/condition (sorry about possible incorrect terminology), how would I go about it?

Background info:

Trying to determine clients who are currently enroute based on when their trip ends ("end_date);

Based on the solutions offered by the various gurus earlier in the thread, this part was easy. I would like to narrow the results to exclude any based on the contents of another field (booking_type..a value list).

Here is what I thought might work (but alas doesn't):

"Enter Find Mode [ ] ... uncheck pause

Set Field [ myDateField ; ">" & Get ( CurrentDate [color:red])& Booking type<> some criteria ]

Perform Find [ ]"

Is there a possible answer by incorporating an "if" and/or "case" function to the calculation?

Any guidance would be appreciated.

As always, TIA to all who respond.

Jack

I would like to narrow the results to exclude any based on the contents of another field

Enter appropriate criteria into the other field, e.g.:

Enter Find Mode []

Set Field [ myDateField ; ">" & Get ( CurrentDate ) ]

Set Field [ Booking type ; ---some criteria--- ]

Perform Find []

Or, if the criteria are excluding:

Enter Find Mode []

Set Field [ myDateField ; ">" & Get ( CurrentDate ) ]

New Request

Set Field [ Booking type ; ---some criteria--- ]

Omit Request

Perform Find []

Edited by Guest

Comment,

Thanks for you response;apparently a re-read of advanced find techniques is in order (I was not aware your method). :

The issue is now with my choice of criteria... here is what I attempted to do:

Enter Find Mode []

Set Field [ myDateField ; ">" & Get ( CurrentDate ) ]

New Request

Set Field [ Booking type ; [color:red]"<>" & Insurance

Omit Request

Perform Find []

FM complained that the "insurance" portion is not a table or a function (it is in fact a choice in the value list assigned to booking type). I was of the thinking that it could be done this way but apparently not. Any thoughts on how to resolve?

Thanks again for the handholding;learning something new everytime I visit this forum.

Jack

I am somewhat guessing here, but it seems you want:

Enter Find Mode []

Set Field [ myDateField ; ">" & Get ( CurrentDate ) ]

New Request

Set Field [ Booking type ; "Insurance" ]

Omit Request

Perform Find []

This should find records whose date is in the future AND type is NOT "Insurance" (or rather does not contain a word that starts with "Insurance").

Comment,

Very fine guess on your behalf... that is exactly what I was looking for and helps explain how to use multiple set field scripts in a solution. IMO, the FM help menu provides the basics; it's better to see it in a actual solution (from my learning perspective anyways).

Thanks for your assistance...now on the next feature to be added.

Jack

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.