Jump to content
Server Maintenance This Week. ×

Need help with date find in script for button


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

Recommended Posts

Hi. I am trying to create a button which will perform a find asking the user to input two dates which they want the records to be between, then to switch to the other layout with the found records. When i go to scriptmaker, i have perform find as the first action with the find request being "Date >= ?" and it won't accept it. how do i get it to ask the user for the dates they want?

Link to comment
Share on other sites

Create two global fields, globStartDate and globEndDate

For the script:

Show Custom Dialog (show the two global fields for the user to put a start and end date)

Go To Layout[Whatever layout it should go to]

Enter find mode [No Pause]

Set Field [Date; globStartDate & "..." & GlobEndDate]

Perform Find

That should do it =)

-----

Martha :bigshades:

Link to comment
Share on other sites

Sorry about that!

globStartDate and globEndDate should be date fields that are global but not calculations so leave them empty.

Also, a note on the script I told you to create:

Before showing the dialog, you can do the following:

If(globStartDate = "")

SetField[globStartDate; Get(CurrentDate)]

End if

If(globEndDate = "")

SetField[globEndDate; Get(CurrentDate)]

End if

That will set values in the two fields if they are emptyo so that when the pop-up comes up, the two fields won't be empty, and it makes it easier for the user to know the date format. The above script steps set them to today's date but you could create a calculation to set them to something else.

Does that clarify?

Link to comment
Share on other sites

Okay.

The global fields are temporary places to put the start date and end date that the user enters for the find.

So after putting a custom dialog box up that asks for start date (globStartDate) and end date (globEndDate), the script can go to the correct layout, enter find mode, set the Date field as globStartDate & "..." & globEndDate, and perform the find. This shows the user only records within those dates.

You can ignore my second post because it's just extra. All it is saying is that you can set the two global fields as some date, so that when the dialog comes up, the two fields won't be empty. So it will say something like:

Please Enter Start and End Dates.

Start Date: 04/11/04

End Date: 04/11/04

HOWEVER, the user will be able to change these dates, so that they will get the right time period they want.

Do you have a file I can look at? That might be more useful.

Link to comment
Share on other sites

Aaah i understand finally! ok, i put everything in, but am having problems properly inputting the following line in the script

Set Field [Date; globStartDate & "..." & GlobEndDate]

I put in Set Field [Date]

because that is all i can put in and i keep getting errors.

"There are no valid criteria in this request. Type a valid request before clicking find. Can i email you the file though this? let me know.

Link to comment
Share on other sites

I put in Set Field [Date]

because that is all i can put in and i keep getting errors.

Set Field [Date]

Then you want to click on "Calculated Result" and enter

globStartDate & "..." & GlobEndDate

Link to comment
Share on other sites

I'm taking a wild guess here becasue I don't use IWP...

Can you put the two global fields at the top of your layout and that way the user can enter the dates and then click a button to run the rest of the script?

Start Date __________ End Date __________ |Run Report|

Link to comment
Share on other sites

Well if that's an acceptable approach, shouldn't it be scripted either but instead filling a portal via a multicriteria relationship, and the run button's script could be reduced to Commit Record.

The reason I say this is that earlier versions had a limitation in listview, preventing more than 5 records shown in listmode, however is this limitation changed, but we used to work around in IWP via a selfjoin portal shown. The workaround isn't in demand any more.

--sd

Link to comment
Share on other sites

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