Jump to content
Server Maintenance This Week. ×

Need to Find based on Multiple find when using a script


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

Recommended Posts

I need to find records that meet a certain request when using a script. 

I've got 2 fields that I need to find across.

Status and Timestamp.  (Timestamp is a timestamp field)

I need to find all records that Status = "Approved"

Also need it to return all records that Status = "Complete" and have a timestamp range from 3am until Current time.

 

I'm not seeing how I do multiple find request using a script.

Thanks for your help.

Link to comment
Share on other sites

I'm not seeing how I do multiple find request using a script.​

The way to do that is to use the New Record/Request step:

Enter Find Mode
Set Field [ Table::status ; "Approved" ]
New Record/Request

Set Field [ Table::status ; "Complete" ]
Set Field [ Table::timeStampField ; ">" & Time ( 3 ; 0 ; 0 ) ]
Set Error Capture [ on ]
Perform Find

Link to comment
Share on other sites

This part is not clear:

have a timestamp range from 3am until Current time.

​From 3am when? Today? What if the current time is less than 3am?

 

I'm not seeing how I do multiple find request using a script.

​One way is to enter find mode, fill out the first request, then call New Record/Request to create another request.

 

Link to comment
Share on other sites

The way to do that is to use the New Record/Request step:

Enter Find Mode
Set Field [ Table::status ; "Approved" ]
New Record/Request

Set Field [ Table::status ; "Complete" ]
Set Field [ Table::timeStampField ; ">" & Time ( 3 ; 0 ; 0 ) ]
Set Error Capture [ on ]
Perform Find

​This worked Perfect..Never Knew the New Record/Request was for that. 

Thanks

Link to comment
Share on other sites

This part is not clear:

​From 3am when? Today? What if the current time is less than 3am?

Your right...Never thought of this part.​

Ot looks like I will need to do an If script that looks a the current time.

If current time is after 3 am then it will need to find based on today date after 3am.

If Current time is between 12am and 2:59am then it needs to find today date between 12am and 2:59 and Yesterday date till 3am.

I guess the part I would need help on is the 2nd If Statement. How do you do a between date?

 

Link to comment
Share on other sites

The Issue is that Days end does not end at 12pm. Their day ends at 3am. So when they run this report  after 12pm and before 3am

They need to only show stuff that was done from the previous day after 3am plus anything that was done between 12am-3am the same day.

I think I've got something that is working, will need to test.

I set a Set a Variable $$TIME_OFFSET

If ( Get ( CurrentTime ) > "12:00:00 AM"; If ( Get ( CurrentTime ) < "03:00:00 AM" ; "TRUE" ; "FALSE" ) ; "FALSE" )

Then I did an IF based script on the TRUE/FALSE Variable to know what FIND script to run based on the current time.

Edited by Devin
Link to comment
Share on other sites

Do they have any future records? If not, you can find the relevant records - i.e. records that occurred after the most recent 3:00 AM - by:

Enter Find Mode []
...
Set Field [ YourTable::YourField ; "≥" & Timestamp ( Get(CurrentDate) - ( Get(CurrentTime) < 10800 ) ; 10800 ) ]
...
Perform Find

Note: 10800 is shorthand for Time ( 3 ; 0 ; 0 ).

Link to comment
Share on other sites

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