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

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

Recommended Posts

Posted

Fm 12.

I’m trying to create a script that finds a range of records over a 30 day period. However, it gives the error “find criteria not valid”

Enter Browse Mode

Set Variable [ $EndDate; Value:Get(CurrentDate) ]

Set Variable [ $StartDate; Value:Get(CurrentDate)-30 ]

Go to Layout [ “Last 30 records” (Primary) ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Primary::Date: “$EndDate&"..."&$StartDate” ] [ Restore ]

Any suggestions?

Posted (edited)

Try this instead:

Set Variable $StartDate; date(month($endDate);Day($endDate)-30;Year($enddate))

Set Variable $range; $StartState & "..." & $EndDate

Perform Find <-use $range in the query 

 

Edited by GisMo
Posted
1 minute ago, LaRetta said:

 

Or even:

Set Variable [ $startDate ; Get ( CurrentDate ) - 30 ] 

For some reason, I've always felt more comfortable about explicitly subtracting the day from the day element of the date constructor. 

Posted

Well, I deleted my response because I saw that John had that originally.

It would be simpler if it was just a single variable:

Set Variable [ $range ; Get ( CurrentDate ) - 30 & ".." & Get ( CurrentDate ) ]

I find removing days from a straight date the simplest rather than using Day ( $date ) - 30.

Posted (edited)

Actually, I should clarify further ... you aren't just using Day ( $date ) - 30 ... you are wrapping with the Date() function ... this all requires additional, needless evaluation and I don't find it clearer - on the contrary, it adds needless clutter.  Let's compare:

Date ( Month ( theDate ) ; Day ( theDate ) - 30 ; Year ( theDate ) )

theDate - 30

Edited by LaRetta
Posted
53 minutes ago, LaRetta said:

Date ( Month ( theDate ) ; Day ( theDate ) - 30 ; Year ( theDate ) )

theDate - 30

I am not sure which one of these requires more evaluations. But certainly the difference - if any - is negligible, and the shorter variation is much clearer.

  • Like 1
Posted

Ok, I found that using a range variable in the perfrom find step worked. Now I would like to filter a portal so that it diplays the records for dates in the last 30 days.

Posted
2 minutes ago, john9210 said:

Now I would like to filter a portal so that it diplays the records for dates in the last 30 days.

Try:

Get ( CurrentDate ) - 30 ≤ PortalTO::Datefield

This is assuming you have no future dates (or that you want to show future dates, if you have them).

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