LVA Posted July 1, 2002 Posted July 1, 2002 I have a search layout in which the users enters a date period in a field and after he clicks on a search button opens a report layout with the period the user chose in the search layout. In the search layout there is a field that is the creation date and the search button has a script that copies to a global field the creation date entered by the user and sets other two global fields with the beginning and the other global field with the ending date. For that to happen I used the function left and right. It works well if the user typed the date like 02/02/02...02/03/02 and for the left function I have left(_gperiod1, 8) and the right function I have right(_gperiod2, 8). The problem is if the user enters a date like 02/02/2002...02/03/2002. I would get as result for the first global field 02/02/20 and for the second global field 02/03/20 Is there a way to use the " ... " as a separator for the global fields and get the two global fields to keep the beginning date and the second global field keep the ending date even not needing to specify a number to count from the left or the right ?
djgogi Posted July 1, 2002 Posted July 1, 2002 Well I have to say that I'm not sure on what are you doing there, but however here's the answer to your question if you don't mind to use copy and paste: Enter Find Mode //do what you have to do Pause [ ] Copy [range] Perform Find //do what you have to do Paste [gStartDate, select] Set Field [gEndDate,"Right(gStartDate, Position(gStartDate, "...", 0, 1)-1)"] Set Field [gStartDate,"Left(gStartDate, Position(gStartDate, "...", 0, 1)-1)"] HTH Dj
LiveOak Posted July 1, 2002 Posted July 1, 2002 If you use begin date and end date global fields, use the follow to setup the find: Enter Find Mode() SetField(Date, Begin Date) Insert Text ("...") <-- Make sure to deselect "Select Entire Contents" Insert Calculated Result (End Date) <-- Make sure to deselect "Select Entire Contents" Perform Find() -bd
djgogi Posted July 1, 2002 Posted July 1, 2002 I think she was trying to get Start and Stop date from Date Range inserted in Find Mode. Obviuosly what you are suggesting is the right way to setup find for date range and she should implement it at place of her design. Just to clarify. Dj
LVA Posted July 2, 2002 Author Posted July 2, 2002 Thanks, I managed to do it using the functions left, right, length and position For the start date - Left(Name, Position(Name, " ", 1, 1)-1) For the end date - Right(Name, Length(Name) - Position(Name, " ", Length(Name), -1)) It worked perfectly. And it is great because I don't need to tell the user what date format he has to enter. He can enter either way , mm/dd/yy or mm/dd/yyyy Luiza
Recommended Posts
This topic is 8184 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 accountSign in
Already have an account? Sign in here.
Sign In Now