Jump to content
Server Maintenance This Week. ×

Splitting a Date Range


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

Recommended Posts

In a database we use to record bank deposits there is a date field for when the deposit was made. I have a report to make that just gives details about deposits over a period of time. My issue is this:

The user can input a date range to generate the report. I would like to display the chosen date range in the header of the report. For example, if in the date deposited field the user were to type 07/01/2007...07/31/2007 I would want the following to display in the header of the report:

07/01/2007 - 07/31/2007

I'm sure there's an easy way to do this but I can't seem to find it.

Any ideas?

Link to comment
Share on other sites

If your process is scripted, then it would be easier for you to use two global date fields as your start and end dates for your range rather than trying to do it with one field.

If you do it that way, then all your report header has to have is a merge field of <> - <>

Link to comment
Share on other sites

[color:red]Show Custom Dialog ["Automated Seach"; "Enter the start and end dates for your search:"; YourTable::gStart; YourTable::gEnd]

If [Get(LastMessageChoice) = 2]

Exit Script [ ]

End If

Enter Find Mode [ ]

Set Variable [$Criteria; Value: YourTable::gStart & ".." & YourTable::gEnd]

Set Field [YourTable::DateField01; $Criteria]

Am I on the right track? I'm not sure how to put it in the format I mentioned.

Link to comment
Share on other sites

You dont really need the extra set variable step. You could just use set field [YourTable::DateField01; Value: v& ".." & YourTable::gEnd]

Perform Find []

Make sure that you compensate for error trapping and the date fields being empty or invalid. One your layout, you can insert merge field of YourTable::gStart space - space YourTable::gEnd.

Link to comment
Share on other sites

mr_vodka,

One more newbie question. Can you explain a particular portion of your response?

In the script you said use [YourTable::DateField01; Value: v& ".." & YourTable::gEnd] instead of the final Set Variable section. I understand that but I don't get part of this function you have provided. I've never used or seen "Value: v&". What is that and what does it do?

Thanks so much for your help. It's nice to know there's people like you and everyone else that's aided me in the past that want to help and do so. It has bettered not only my base knowledge but my unit here at work as well.

Thanks.

Link to comment
Share on other sites

Sorry that was a copy and paste error from your post.

It should be:

Set Field [YourTable::DateField01; YourTable::gStart & ".." & YourTable::gEnd ]

Link to comment
Share on other sites

I'm having an issue with my script so if anyone can straighten it out I would be much appreciative. This is the important part of it where the issues lie:

[color:red]Show Custom Dialog ["Automated Seach"; "Enter the start and end dates for your search:"; YourTable::gStart; YourTable::gEnd]

If [Get(LastMessageChoice) = 2]

Exit Script [ ]

End If

Enter Find Mode [ ]

Set Field [YourTable::DateField01; YourTable::gStart& "..." & YourTable::gEnd]

Perform Find

When the report comes up instead of giving me a the date like this, "07/01/2007 - 07/31/2007" I just get the start date.

Now I did try and set a global field after setting the actual date field but the global field only shows up on certain pages, which is just plain weird.

Also, DateField01 is a date field which likely explains why it won't give me the full range on the report but how do I set the script up to search within that field and set another field to display the range?

Link to comment
Share on other sites

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