Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Date range


Recommended Posts

I have a call directory for each employee set up so they can see calls that came in while they were out or for reference. The function of it works fine. I have the ability for them to sort by caller and calls from today. I would like to add the ability to let them see their calls for the week. How would I do this without having to manually change it each week?

Link to comment
Share on other sites



Enter Find Mode []

Set Field [TelCalls Table::EmployeeName, Get(AccountName)]*

Set Field [TelCalls Table::Call Date, Get(currentdate)- Let ( [subtract = Case(DayOfWeek(Get(CurrentDate))=1 or DayOfWeek(Get(CurrentDate))=2; 0; DayOfWeek(Get(CurrentDate))-2)]; Get(CurrentDate) - Subtract )]

Set Error Capture [On]

Perform Find []

If [Get(FoundCount) = 0]

Show Custom Dialog ["No one called you this week, sorry" "OK"]

Show All Records

Exit Script

End If

Go to Layout [Calls ListView]



* or however you've got it set up for employees to identify themselves to the system. If you've got an Employee ID that gets tossed into a global at logon time, use that, etc

Link to comment
Share on other sites

First of all, thanks for responding....


Something isn't working for me though. Lets leave the employee identification part out of it because I have a button they choose from a call directory that takes them to their own layout where only their calls are shown. When they get there all of their calls are shown with the most recent call at the top of the list. I have a button there where they can view the calls from today. This script would be for their calls for the week. I'm having trouble deciphering what "subtract" is equal to here. The case statement is throwing me off.


Case(DayOfWeek(Get(CurrentDate))=1 or DayOfWeek(Get(CurrentDate))=2; 0; DayOfWeek(Get(CurrentDate))-2)


Test 1 is saying the day of the week is Sunday or Monday and the result is 0?

I'm confused.


Thanks for responding, and thanks in advance if you respond again.

Link to comment
Share on other sites

I figured if "today" is either Sunday or Monday you'd just want to see today's calls — with the assumption that "the week" begins on Monday morning with the rare exception of someone working on a Sunday, for whom "the week" just means today because "the week" that just passed is over and "this week" actually starts tomorrow... OK, I suppose that doesn't parse particularly well.


It seemed like a good idea at the time. No matter. You decide when you want "the week" to start, and then just do the math to set "subtract" so that "subtract" is the number of "days ago" that the start of the week was, based on the DayOfWeek of Get(CurrentDate).

Link to comment
Share on other sites

I have no idea what I'm doing wrong. This is returning only Mondays calls. Can I include todays as well? Here's my script:


Enter Find Mode[]


Set Field[MyTable::MyDate; Let (Subtract = DayOfWeek(Get(CurrentDate))-2;Get(CurrentDate) - Subtract )]


Set Error Capture [on]


Perform Find[]


If[Get(FoundCount) = 0]


Show Custom Dialouge[no calls]


Show all Records


Exit Script[]


End if


Thanks again

Link to comment
Share on other sites

My fault. I need coffee. Set the field to what you just set it to (as described above) then append this to it:


& "..." & Get(CurrentDate)


You don't want only the records for the first of the week, you want the ones starting with the first of the week and up to and including the current date.


I kinda left off the "from then until today" part and left you with how to snag the starting point. Sorry 'bout that.

Link to comment
Share on other sites


  • Create New...

Important Information

Terms of Use