Jump to content

Sort by start date and end date


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

Recommended Posts

I'm not sure if there's an easier way but here's my advice (This requires that the global fields be on the actual layout you are on, which means you can hide them or display them if you want to show what the time period is):D

Create two global fields: "GlobStartDate" and "GlobEndDate"

In the script, show a custom dialog that asks the user for a start date and end date (if you want, before the dialog, you can set these two fields to a "default" date so that when the dialog comes up, it has dates already set, but changeable).

Script Steps:

Freeze

Copy GlobStartDate

Enter Find Mode [No Pause]

set field [ Date; ">="]

paste [do not select all] Date

Perform Find

Copy GlobEndDate

Enter Find Mode [No Pause]

Set field [Date; "<="]

paste [do not select all] Date

Constrain Found Set

Sort [No dialog] by Date

Let me know what you think.

Link to comment
Share on other sites

I inputed the data as you typed, and I can really see where this will work, it is just beyond me. Here is what I scripted fmsort1.gif It is not item for item the same as yours. I hope you can show me where I went wrong. Here is a image of what the layout I am trying to sort. fmsort2.gif The data starts in 2004 and ends toi current. I just want the data displayed for the date range I specify.

I have the hidden GlobStartDate and GlobAEndDate field as you suggested.

Thanks for the ongoing help!

FKSSTECHGUY

Link to comment
Share on other sites

After taking a second look at it, I think this is better:

Freeze

Show Custom Dialog (just like you have it, asking for the start date and end date, which are glob fields)

Enter Find Mode [No Pause]

set field [ Date; ">=" & globStartDate]

Perform Find

Enter Find Mode [No Pause]

Set field [Date; "<=" & globEndDate]

Constrain Found Set

Sort [No dialog] by Date

This way you don't have to hide the global fields.

Link to comment
Share on other sites

I inputed the data as you typed, and I can really see where this will work, it is just beyond me. Here is what I scripted fmsort1.gif It is not item for item the same as yours. I hope you can show me where I went wrong. Here is a image of what the layout I am trying to sort. fmsort2.gif The data starts in 2004 and ends toi current. I just want the data displayed for the date range I specify.

I have the hidden GlobStartDate and GlobAEndDate field as you suggested.

Thanks for the ongoing help!

FKSSTECHGUY

Link to comment
Share on other sites

The changes I made were with the "Paste" and "set fields" script steps. I took out the "Copy" step and made it all work through the Set Field script step.

Did you make those changes? If you did, I don't see them reflected in your last post.

Let me know! I hope it works!

Martha

Link to comment
Share on other sites

Have you attempted my second suggestion?

Remove the Copy Script Steps.

Remove the Paste Script Steps.

Change the Set Field [] steps as follows:

[color:blue]

Set Field [ Date; ">=" & globStartDate]

Set Field [ Date; "<=" & globEndDate]

Link to comment
Share on other sites

We are sooooo close...

It do the sort, but only displays information from the GlobEndDate field.

Here is my script:

Freeze Window

Show Custom Dialog (just like I have it)

Enter Find Mode[]

Set Field["Date","">="&GlobStartDate"]

Enter Find Mode[]

Set Field["Date",""<="&GlobEndDate"]

Perform Find[Constarin Found Set]

Sort[No Dialog]

I removed the Preform Find in the middle of the script that you sent as it was giving me grief and The script went through we just have this other wrinkle to get through!

Thanks

Also I am working with FMP 6. I do work with FMP 7 for most, but this PC that I am working on only has 6.

Edited by Guest
Link to comment
Share on other sites

My knowledge on 6 is limited :D

Maybe someone else can help?

As far as I know (and please someone correct me if i'm wrong) that middle Perform Find step is necessary to create a found set of dates greater than your global start date.

I would say put the "Perform Find" back in the script and put a pause after it. What happens?

Link to comment
Share on other sites

Eureka! I ported the db into FMP7, tweaked the script a bit and it works marvelously! Here it is:

Freeze Window

Show Custom Dialog ([color:blue]just like I have it)

Enter Find Mode[]

Set Field[Transactions::Date;">="&Transactions::GlobStartDate]

Preform Find[]

Enter Find Mode[]

Set Field[Transactions::Date;"<="&Transactions::GlobEndDate]

Constarin Found Set

Sort Records[Restore; No Dialog] [color:blue](by date)

Thanks you!

Link to comment
Share on other sites

Enter Find Mode[]

Set Field[Transactions::Date;">="&Transactions::GlobStartDate]

Preform Find[]

Enter Find Mode[]

Set Field[Transactions::Date;"<="&Transactions::GlobEndDate]

Constarin Found Set

This might be simpler:

Enter Find Mode []

Set Field [ Transactions::Date ; Transactions::GlobStartDate & "..."& Transactions::GlobEndDate ]

Perform Find []

Link to comment
Share on other sites

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