Bikeman17 Posted May 24, 2004 Posted May 24, 2004 Hi there, I do my cashouts from 4pm to 4pm opposed to daily. I developed a script that searches in part the sales. Fields: Date (Date): Creation Date Time (Time): Creation Time Yesterday Today(Calculation - text): DateToText(Today- 1) & "..." & DateToText(Today) Four Oclock (Time - Auto Enter data): 16:00:00 Four Oclock Minus one Second (Time - Auto Enter Data): 15:59:59 Four Oclock String (Calculation - text): TimeToText(Four OClock) & "..." & TimeToText(Four OClock Minus One Second) The Script: Copy (Select "Yesterday Today") Enter Find Mode() Paste (Select "Date") Go To Field (Time) Pause/Resume Script() Insert Text (Select "Time") Perform Find (Replace Found Set) --- I know there is something wrong but I can't pin point the problem. I want to use the Four Oclock String field but I don't how to make it work with the search script! Any help is welcome, bk17
Lee Smith Posted May 24, 2004 Posted May 24, 2004 Hi bk17, I would recommend a couple of changes in your calculations and script: It is better to use the function Status(CurrenDate) instead of Today. You will find that you'll have better control over results by using Insert Calculated results instead of paste. Date and Times can be tricky, so if the changes don't do it, be sure and check that the calculations are Date and Time (fields or Results are in Date and Time), or you may need to convert them by using Text to Date and Text to Time in your calculations. HTH Lee
Bikeman17 Posted May 24, 2004 Author Posted May 24, 2004 I modified Today to Status(CurrentDate) and replace Paste by Insert Text but no result. I modified the script. It looks like this now: Copy (Select "Yesterday Today") Enter Find Mode() Insert Text (Select "Date") Copy (Select "Four Oclock String" Insert Text (Select "Time") Perform Find (Replace Found Set) --- Any help- bk17
-Queue- Posted May 24, 2004 Posted May 24, 2004 I would split this into two requests, one for yesterday after 3:59, and one for today before 4 PM. Enter Find Mode [ ] Set Field [Date, Status(CurrentDate) - 1] Insert Text [select, Time, ">=16:00:00"] New Record/Request Set Field [Date, Status(CurrentDate)] Insert Text [select, Time, "<16:00:00"] Perform Find[ ] I haven't tested this too much. So let me know how it works out.
Bikeman17 Posted May 24, 2004 Author Posted May 24, 2004 It didn't work. I guess a few test is required from you. thanks, bk17
-Queue- Posted May 24, 2004 Posted May 24, 2004 Try Insert Calculated Result instead of Insert Text, and be more specific about how it didn't work. What were the results?
Lee Smith Posted May 24, 2004 Posted May 24, 2004 See if this little file is what you are after. Lee For_Bikeman.fp5.zip
-Queue- Posted May 24, 2004 Posted May 24, 2004 It doesn't work because Four Oclock string does not exist in Find Mode, so you can't copy it. You're only finding records from yesterday and today. I don't think it will work that way anyway, because 16:00:00...15:59:59 is like saying Status(CurrentDate) & "..." & Status(CurrentDate) - 1. The starting value is greater than the ending one, which is why I split it into two days.
Lee Smith Posted May 24, 2004 Posted May 24, 2004 You are right of course. Duh. I didn't get an error beep, so it appeared to work. Lee
Bikeman17 Posted May 25, 2004 Author Posted May 25, 2004 Hi Queue I am a bit puzzle with your comment: Try Insert Calculated Result instead of Insert Text. Do I use that with the four oclock string? Do I enter any information in Specify? In any case, can you build me a script that would work? looking for your reply bk17
-Queue- Posted May 25, 2004 Posted May 25, 2004 Use the same steps I provided earlier, just substitute Insert Calculated Result for Insert Text. Insert Text worked fine for me, but I haven't done much work with time fields. They seem much more persnickity than date fields. Add Pause/Resume steps after setting the time field to see what data is being entered.
Bikeman17 Posted May 25, 2004 Author Posted May 25, 2004 Queue, The Insert Calculated Result doesn't let me enter '>=16:00:00' in Specify. There is a syntax error. bk17
-Queue- Posted May 25, 2004 Posted May 25, 2004 Are you using single or double ticks around the text? Can you attach the file?
Bikeman17 Posted May 25, 2004 Author Posted May 25, 2004 Queue, OKay, I added the quote. I performed the script but it didn't work. I decided to build you a little file. I created 5 records. The script should find 2 out 5. I imported the script and it worked with the little file. I almost step out of my chair. What's wrong with my genuine file? Some clues... Date and Time fields are creation fields. When I perform the script, the view is a form. All fields can be seen on screen. Gosh, any idea!! bk17
Vaughan Posted May 25, 2004 Posted May 25, 2004 Firstly, the Insert Calculated Result script step requires that the referenced field is on the current layout. If it isn't the insert won't happen. It's caught me before. Secondly, are the date and time fields *really* date and time fields? (Not data type text.)
Bikeman17 Posted May 25, 2004 Author Posted May 25, 2004 Hey Vaughan, Thanks for your comments. They sparked a solution. I realized that my Date and Time fields were located in the header. I moved them and it worked perfectly. I use a view form to do my cash out. All fields are displayed to do a nice print out. bk17
Recommended Posts
This topic is 7490 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