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

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

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted (edited)

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
Posted

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:

Posted

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

Posted

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.

Posted

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 []

Posted (edited)

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
Posted

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.

Posted

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.

Posted

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]

Posted

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

Posted

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:

  • 1 year later...
Posted

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

Posted (edited)

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
Posted

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

Posted

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").

Posted

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

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