"Next X Hours" filter is not working as expected in CRM 2011 - dynamics-crm-2011

I have added a custom field named "due by" in queueitem entity. Then I created a system view named "Calls due next 1 hour" again in the queueitem entity with filter condition as:
Field: due by Filter: Next X Hours Value: 1
But this view seems to behave wrongly. E.g. Suppose current system time is say H:MM AM/PM, then this view is displaying all the records which are due by till H+1:59 AM/PM. While I am expecting it to display all the records which are due by till H+1:MM AM/PM only.
Because of this issue, my custom view is displaying records in the range or around next 1 - 2 hours. E.g. if the current system time is 10:01 AM it displays records till 11:59 AM which is around 2 hours whereas if current system time is 10:59 AM, it again displays records till 11:59 AM which is 1 hour.
This seems to be a bug in "Next X Hours" filter of CRM because I have checked it for some other entities as well by creating a custom view with "Next X Hour" filter where X is set to 1 and all are displaying records till 59th minute of next hour.
I have posted this issue here just to confirm whether this is really a bug or only I am facing this.
Thanks

This is something that I see in a lot of CRM views' pre-built filters, especially around date fields - the name of the field does not really indicate what it will do. In addition to your example, the "Last Year" filter to me would indicate that it should return results from the last 365 days ("in the last year"), but in reality it returns all results where the calendar year is equal to current year - 1 (same with last month, last week, next year, next month, etc.). Your question seems to be about the same concept (the next 1 hour is where hour = current hour + 1).
The only solution is to be sure to test out all the filters so you know exactly how they behave instead of relying on how you interpret the wording. It's a bit obnoxious, but it has to be done.

Related

Netsuite: Creating Usage Report by Period

I am trying to create a saved search that gives the quantity/sales amount in NetSuite for the previous months to track usage on an item, customer and sales rep level. I have somewhat of a solution however the way my formula is set up it is going off of the system date rather than the whole previous month(s). For example, if I ran the search today it would give me the usage from today (Feb 7) back to Jan 7, Dec 7 and Nov 7. But I know NetSuite has 'Period' as a date function and struggling to incorporate that instead.
My formula is below for an example.
NULLIF(CASE WHEN {trandate} > ADD_MONTHS(SYSDATE,-1) THEN CASE WHEN {type} = 'Invoice' THEN NVL({amount},0)*1 ELSE 0 END ELSE 0 END,0)
ADD_MONTHS(SYSDATE,-1) <---I change this to -2 and -3 to show previous 2 and 3 months as well
I am attempting to avoid doing 12 of these as a CASE WHEN posting period = P1 2021 THEN amount etc etc so we can have more of a rolling sales/quantity search.
Does not seem like NetSuite likes having to pull a point in time value, it likes to base searches/reports from the time it is run. But that could be being new'ish to NetSuite as we converted a few months ago.
Output of the saved search
Results with grouping and summarizing
TRUNC(ADD_MONTHS(SYSDATE,-2),'Month')-1

Excel - Formula to filter column based on variable time

I have a column that needs split based on "morning" and "evening" although the morning and evening times move every day (it's based on sidereal day). Calling them morning and evening is a little deceiving though because eventually the time will creep into the next day and I want to keep the groups distinct. It is more accurate to call them group 1 and group 2. It just so happens that they are around 12 hours apart so it looks like you can just separate based on time of day but once the later group creeps into the AM hours, it would start to get counted as "morning" and the earlier group would roll into the afternoon and be counted as "afternoon" See screenshot below for example data.
I need them split so I can perform operations on the value column so I can distinguish the values in the first group from the values in the second group. I thought of doing some sort of flip flop algorithm based on the previous cell but there may be a more elegant way to do it. Also, it's not shown on the example data but sometimes the day may skip but the times more or less continue in the same pattern of increasing by 3-5 minutes each day.
A date with a time stamp is stored as a number in Excel. Days are stored as whole numbers, time is stored in decimals. So, disregarding the date part, look at the decimal of the number and determine if that is before or after the time you want.
0.5 for example is midday, or 12 noon. So if the decimal part of A1 is less than 0.5, the time stamp would be in the morning.
=if(A1-int(A1)<0.5,"before noon","after noon")
It is not clear from your question how sidereal relates to the data in your sample.

Create Sharepoint filter to show documents expiring within 30 days

I am using sharepoint 2013 and am creating a document view to show contracts that are going to expire within 30 days of today. I have a column called expiry date. Example, if today was Jan 15th, I want to show all contracts from Dec 15th to today.
How can I create a filter to do this?
I have tried expiry date less than or equal to [Today] - 30 but that didn't work as it bring back incorrect data.
The filter should read:
Less Than or Equal To
[Today]+30
It will not accept spaces in the formula. [Today]-30 would be stuff that had already expired.
I was having a time with this as well. Try this
Due Date is less than or equal to [Today]+30
AND
Due Date is greater than or equal to [Today]
Filter should be (based on your column name above):
Expiry Date > = Today and <= Today+30
This starts with the beginning date to the latest date (30 days later)

SharePoint View to automatically show only the current month?

I need to create a view that will automatically change from month to month to show only the current month (i.e. if current month is July - show items posted in July). Currently I have a view set up, but I have to manually change the month each time it changes (it's set up based on the first day of the current month and the last day of current month).
Thanks
You can do this by turning the problem on its head.
First you need to add two calculated columns that will work out the start an the end of the month. (This example uses [Due Date] but you can use any date/time column)
"Start of Month" =DATE(YEAR([Due Date]), MONTH([Due Date]), 1)
"End of Month" =DATE(YEAR([Due Date]), MONTH([Due Date])+1,1)-1
Then you setup a filter in your view for
"Start of Month" is less than or equal to [Today]
AND
"End of Month" is greater than or equal to [Today]
How To Use Filters in SharePoint to show items in the current Calendar Month
Create a CC "NextMonth" that adds one month to your date
=DATE(YEAR(Modified),MONTH(Modified)+1,"1")
create a view "ThisMonth" with this filter
"NextMonth" is greater than [Today]
this will always return the current month. can also be allpied to Year, to return current year
Create a CC "NextYear" that adds one year to your date
=DATE(YEAR(Modified)+1,MONTH(Modified),"1")
create a view "ThisYear" with this filter
"NextYear" is greater than [Today]
Now the trick is to return a view for last Month. Let me know if you figure this out
EDIT: Please see Ryan's solution below, it's more comprehensive.
I believe there is no out of the box solution for that. One trick can be to write code in default view which would actually set the month for you or redirect to any other view. Something like
SPWeb web = SPContext.Current.Web;
string[] monthViewUrls = { "url1", "url2", ... };
string currentMonthUrl = monthViewUrls[DateTime.Now.Month-1];
Response.Redirect(currentMonthUrl );
Hope this helps.
Can you live with the calendar view? That shows current month by default. Maybe you can start with that and try to customize it in SPD - it might retain its current month behavior.
Start of Previous Month
=DATE(YEAR(Created),MONTH(Created)-1,"1")
End of Previous Month
=DATE(YEAR(Created),MONTH(Created),-1)

SharePoint column default values - add 10 working days

In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is "Incoming Date" and another is the "Due Date".
The Due Date is always 10 working days from the Incoming Date. The Incoming Date is when the mail room received the letter, not necessarily when the document is posted to the library.
From here: http://msdn.microsoft.com/en-us/library/bb862071.aspx
=DATE(YEAR([Incoming Date]),MONTH([Incoming Date]),DAY([Incoming Date])+10)
adds 10 days, but how can I add 10 working days? I don't have the luxury of VS.NET either per the governance plan of our sharepoint rollout.
Assume a human is responsible for the data entry, but I would like to make it easier for them.
It's overkill for the very specific '10 days' requirement, but this should calculate a due date for any number of days from any start date.
I wrote it to match the result of Excel's WORKDAY function (which, given that every function in a calculated field is an Excel function, should almost be a thing). It's tested for 1 to 146 "days to complete", for each day of the week, and across years, without any sign of inconsistency. Unless I made a typo copying it from Excel, it should work as advertised. The only down side is that it doesnt do holidays, but if the users are accustomed to SharePoint they wont have expectations anyway. At all. Of any kind. For anything. Or hope. Or the muscles in their face that used to be responsible for smiling. Or the ability to look at a child and see anything but the bleak certainty of withering death. So, not a big deal if their task is due on Christmas. It's also sloppier than it probably needs to be.
=[Start Date]+[Days to Complete]
+ ROUNDDOWN([Days to Complete]/5,0)*2
+ IF(WEEKDAY([Start Date])+MOD([Days to Complete],5)>=7,2,0)
- ROUNDDOWN(WEEKDAY([Start Date])/7,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=1),-2,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=7),-2,0)
The first line is...obvious. The second line adds weekends. And the next 4 lines adjust for the deficiencies of the second line.
Firstly I should point out that you are making hard work of that formula, this will do the same.
=[Incoming Date] + 10
From the comments you have figured out that 10 working days (M-F) will always have 2 weekends so you can use this
=[Incoming Date] + 14
But this still doesn't take account of holidays
You are not going to be able to do this without some custom code in a workflow or possibly some javascript 'hack' and a database of holiday days for your region.
One possibility would be to default your Due Date to 10 working days from now when the record is created
=Today+14
and then rely on your users to manual alter this date if there are holidays in that period.
More details on this in a blog entry I've just written - Working Days, Weekends and Holidays in SharePoint Calculated Columns
Perhaps you can work around this limitation by using a workflow (possibly a custom one) to manage the due date? A due date implies that it is an actionable item that should be assigned to somebody anyways.
Note that VS.NET doesn't have to be a luxury - you can use it for free.
I believe I've figured out a fairly bullet-proof method for calculating a 10 business day deadline that accounts for holidays and weekends. 1) Calculate whether the 2 week period is a Monday, and if so, add only 11 days (assuming the start day counts as Day1 of your 10-day period). Otherwise, you add 13 to account for the 10 working days plus two weekends (remember, the start date already counts as Day1; your variables would be 12 and 14 if you did NOT count the start date as Day1). 2) Create a unique calculated column for every holiday and return a value of 1 if the holiday falls in the range. 3) Determine your "gross date" by adding values (weekends and holidays) to your start date. 4) Determine whether your gross date falls on a Saturday or Sunday, and if so, return the appropriate number of days to push off until Monday. 5) Add all the weekend, holiday, and added Sat and Sun values to your start date, which gives you your due date.
NOTE: The only challenges I see here is if a holiday pushes the due date into the weekend, which then pushes the due date to a Monday that happens to be yet another holiday. This didn't happen in my holiday schedule, but it might in yours. In addition, you'll need to keep adding new holidays every year, thus requiring you to recreate the column arrays from scratch for a long-running list. Alternatively, you could start a new list every year.
C_Wknd =IF(TEXT(WEEKDAY([Complaint Created On]),"ddd")="Mon",11,13)
C_NYDay =IF(AND([Complaint Created On]<=DATE(2009,1,1),([Complaint Created On])+C_Wknd>=DATE(2009,1,1)),"1","0")
C_MLKDay =IF(AND([Complaint Created On]<=DATE(2009,1,19),([Complaint Created On])+C_Wknd>=DATE(2009,1,19)),"1","0")
C_MemDay =IF(AND([Complaint Created On]<=DATE(2009,5,25),([Complaint Created On])+C_Wknd>=DATE(2009,5,25)),"1","0")
C_PresDay =IF(AND([Complaint Created On]<=DATE(2009,2,16),([Complaint Created On])+C_Wknd>=DATE(2009,2,16)),"1","0")
C_IndDay =IF(AND([Complaint Created On]<=DATE(2009,7,4),([Complaint Created On])+C_Wknd>=DATE(2009,7,4)),"1","0")
C_LabDay =IF(AND([Complaint Created On]<=DATE(2009,9,7),([Complaint Created On])+C_Wknd>=DATE(2009,9,7)),"1","0")
C_ColDay =IF(AND([Complaint Created On]<=DATE(2009,10,12),([Complaint Created On])+C_Wknd>=DATE(2009,10,12)),"1","0")
C_VetDay =IF(AND([Complaint Created On]<=DATE(2009,11,11),([Complaint Created On])+C_Wknd>=DATE(2009,11,11)),"1","0")
C_ThxDay =IF(AND([Complaint Created On]<=DATE(2009,11,26),([Complaint Created On])+C_Wknd>=DATE(2009,11,26)),"1","0")
C_XmsDay =IF(AND([Complaint Created On]<=DATE(2009,12,25),([Complaint Created On])+C_Wknd>=DATE(2009,12,25)),"1","0")
C_GrossDte =[Complaint Created On]+C_Wknd+C_NYDay+C_MLKDay+C_MemDay+C_PresDay+C_IndDay+C_LabDay+C_ColDay+C_VetDay+C_ThxDay+C_XmsDay
C_EndSat =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sat",2,0)
C_EndSun =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sun",1,0)
Resolution Due =C_GrossDte+C_EndSat+C_EndSun

Resources