September 30, 200718 yr Greetings I need to keep an eye on our sales team's weekly numbers. How can I generate a script that finds all invoices for last week (which would theoretically be every Monday to Sunday). Thanks!
September 30, 200718 yr Set Error Capture [ On ] Enter Find Mode [ ] ... uncheck pause Set Field [ InvoiceDate ; Let ( start = Get ( CurrentDate ) - DayOfWeek ( Get ( CurrentDate ) ) - 5 ; start & ".." & start + 6 ) ] Perform Find [ ] If [ not Get ( FoundCount ) ] Show Custom Dialog [ OK ; "No records found" ] Show All Records End If
September 30, 200718 yr I would make the calculation = Let ( [ today = Get (CurrentDate) ; mon = today - DayOfWeek ( today - 1 ) - 6 ] ; mon & ".." & mon + 6 ) The difference comes to play on Sunday. If today is Sunday, it will still calculate the dates of LAST week, i.e. the week beginning on the Monday before last.
September 30, 200718 yr I assumed monsta would want the week ending that day (if on Sunday). This was poor assumption because it is possible that the day's invoices have not yet been entered, ie, sales for the day will still happen for several hours! Your calc is clearer as well. :wink2: Edited September 30, 200718 yr by Guest
Create an account or sign in to comment