Jump to content
Server Maintenance This Week. ×

Find range of dates with script variables


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

Recommended Posts

I can't get find a range of dates with a script. The following script is supposed to find the last 12 records on the layout. The Perform Find results in the error that the provided find criteria is not correct. Even if I use Enter Find Mode and insert the variables, I get the same error. What gives?

 

Layout [ “Log” ]

Show All Records

Sort Records [ Keep records in sorted order; Specified Sort Order: Log::Date; ascending ] [ Restore; No dialog ]

Go to Record/Request/Page [ Last ]

Set Variable [ $End; Value:Log::Date ]

Set Variable [ $start; Value:$end-12 ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Log::Date: “$start...$end” ] [ Restore ]

//Enter Find Mode [ ]

//Set Field [ Log::Date; $start...$end ]

//Perform Find

Link to comment
Share on other sites

Could it be a simple typo?  You are setting $End (capital 'E") and performing a find on $end (lowercase 'e').

However, if you're looking for the last 12 records

Show All Records

Sort Records...

Go to Record/Request/Page [First]

Omit Multiple Records [With dialog:Off; Get(TotalRecordCount)-12]

 

Link to comment
Share on other sites

9 hours ago, john9210 said:

Perform Find [ Specified Find Requests: Find Records; Criteria: Log::Date: “$start...$end” ] [ Restore ] 

Because the $start and $end variables are not used correctly.

What you need is: $start & "..." & $end

Notice the quotation marks. When you do “$start...$end” the variables aren't converted to their values, but instead are used literally.

6 hours ago, comment said:

You cannot use more than one variable in a stored find request.

Yeah you can. 😛

Perform Find [ Specified Find Requests: Find Records; Criteria: Log::Date: $start &"..." & $end ] [ Restore ] 

Works perfectlly fine. 😛

 

Link to comment
Share on other sites

1 hour ago, OlgerDiekstra said:

Perform Find [ Specified Find Requests: Find Records; Criteria: Log::Date: $start &"..." & $end ] [ Restore ] 

Works perfectlly fine. 😛

I don't think so. You cannot perform calculations in a find request. 

Link to comment
Share on other sites

Ah, you're right. I usually use enter find mode and set fields. With perform find you'd have to create a single variable that holds from and to date, and use that single var in the perform find.

Like so:

set variable[ $daterange; $start & "..." & $end ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Log::Date: $daterange ] [ Restore ] 

  • Like 1
Link to comment
Share on other sites

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