Formula for SSRS - iif today display column in textbox - sharepoint

Can anyone help me out? We're on-call for 1 week at a time.
I'm trying to display on the dashboard who is on-call this week.
I'm trying to write the following formula:
Display whatever is in 'Who's on Call' column if they are on-call this week.
Please help, I just cannot put my head around it.
<RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListName>On Call Calendar</ListName>
<ViewFields>
<FieldRef Name="Title" />
<FieldRef Name="Location" />
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="Description" />
<FieldRef Name="fAllDayEvent" />
<FieldRef Name="fRecurrence" />
<FieldRef Name="ParticipantsPicker" />
<FieldRef Name="Category" />
<FieldRef Name="Facilities" />
<FieldRef Name="FreeBusy" />
<FieldRef Name="Overbook" />
<FieldRef Name="Workspace0" />
<FieldRef Name="Partial_x0020_Hours" />
<FieldRef Name="Encoded_x0020_Absolute_x0020_URL" />
<FieldRef Name="Item_x0020_Type" />
<FieldRef Name="Path" />
<FieldRef Name="URL_x0020_Path" />
<FieldRef Name="Workflow_x0020_Instance_x0020_ID" />
<FieldRef Name="File_x0020_Type0" />
<FieldRef Name="_OldID" />
<FieldRef Name="LinkTitleNoMenu" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="Whos_on_Call" />
<FieldRef Name="ID" />
<FieldRef Name="ContentType" />
<FieldRef Name="Modified" />
<FieldRef Name="Created" />
<FieldRef Name="Author" />
<FieldRef Name="Editor" />
<FieldRef Name="_UIVersionString" />
<FieldRef Name="Attachments" />
<FieldRef Name="Edit" />
<FieldRef Name="DocIcon" />
<FieldRef Name="ItemChildCount" />
<FieldRef Name="FolderChildCount" />
<FieldRef Name="AppAuthor" />
<FieldRef Name="AppEditor" />
</ViewFields>
</RSSharePointList>'

Related

CAML error when querying SharePoint List for more than one input

I have a CAML query which retrieves data from a SharePoint list. It passes for 1 input, but fails when there are 2 or more.
Error:
Microsoft.SharePoint.SPException: One or more field types are not
installed properly. Go to the list settings page to delete these
fields. ---> System.Runtime.InteropServices.COMException: One or more
field types are not installed properly. Go to the list settings page
to delete these fields.
After researching, probable cause may be due to mismatch SharePoint column InternalName . However, query managed to execute for 1 input, but not 2 or more.
Base on the query examples below, am I having a wrong format for the FAIL cases?
1. PASS:
<Where>
<And>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
</Eq>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Where>
2. FAIL:
<Where>
<And>
<Eq>
<And>
<Or>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
</Eq>
<Eq>
<FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value>
</Eq>
</Or>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Eq>
</And>
</Where>
3. FAIL:
<Where>
<And>
<Eq>
<And>
<Or>
<FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value>
<FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value>
</Or>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Eq>
<Neq>
<FieldRef Name ="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Where>
It is the CAML Query issue, I modify the code as below for your reference.
string siteUrl = "http://sp2013";
string listTitle = "DL";
string viewName="Test";
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists[listTitle];
SPView view=list.Views[viewName];
string orQuery = "<Or><Eq><FieldRef Name=\"Header1Ref\"/><Value Type=\"Text\">H1</Value></Eq><Eq><FieldRef Name=\"Header1Ref\"/><Value Type=\"Text\">H2</Value></Eq></Or>";
string subQuery = String.Format("<Neq><FieldRef Name =\"ContentType\"/><Value Type=\"Text\">{0}</Value></Neq>", "Document");
string queryText = String.Format("<Where><And>{0}{1}</And></Where>", orQuery, subQuery);
var query = new SPQuery(view)
{
Query = queryText,
ViewAttributes = "Scope=\"RecursiveAll\"",
ViewFields = #"<FieldRef Name='RecordTitle'/>",
};
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items)
{
Console.WriteLine(item["RecordTitle"]);
}
Console.ReadKey();
}
}
The CAML Query as below.
<Where>
<And>
<Or>
<Eq><FieldRef Name="Header1Ref"/><Value Type="Text">H1</Value></Eq>
<Eq><FieldRef Name="Header1Ref"/><Value Type="Text">H2</Value></Eq>
</Or>
<Neq>
<FieldRef Name="ContentType"/><Value Type="Text">Document</Value>
</Neq>
</And>
</Where>

Compare DateTime for daily, weekly and monthly duration within CAML Query

I have 3 dates inserted in my list and they are:
1/1/2014 7:00 PM daily
12/2/2013 7:00 PM weekly
12/26/2013 7:00 PM monthly
I want CAML query in such a way that my current DateTime is 1/2/2014 6:22 PM. I want all these records selected as they are fall into next hour and duration given.Please can anybody suggest me how to write query for this?
CAML Query as following:
<Query>
<Where>
<Or>
<And>
<Eq>
<FieldRef Name='DeliveryFrequency' />
<Value Type='Choice'>Daily</Value>
</Eq>
<And>
<Geq>
<FieldRef Name='LastDeliveryTime' />
<Value Type='DateTime'>[Today-1Day(s)]</Value>
</Geq>
<And>
<Geq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now-1Day(s)]</Value>
</Geq>
<Leq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now+60Minute(s)]</Value>
</Leq>
</And>
</And>
</And>
<Or>
<And>
<Eq>
<FieldRef Name='DeliveryFrequency' />
<Value Type='Choice'>Weekly</Value>
</Eq>
<And>
<Eq>
<FieldRef Name='LastDeliveryTime' />
<Value Type='DateTime'>[Today-7Day(s)]</Value>
</Eq>
<And>
<Geq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now-7Day(s)]</Value>
</Geq>
<Leq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now-7Day(s)+60Minute(s)]</Value>
</Leq>
</And>
</And>
</And>
<And>
<Eq>
<FieldRef Name='DeliveryFrequency' />
<Value Type='Choice'>Monthly</Value>
</Eq>
<And>
<Eq>
<FieldRef Name='LastDeliveryTime' />
<Value Type='DateTime'>[Today-1Month(s)]</Value>
</Eq>
<And>
<Geq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now-1Month(s)]</Value>
</Geq>
<Leq>
<FieldRef Name='LastDeliveryTime' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>[Now-1Month(s)+60Minute(s)]</Value>
</Leq>
</And>
</And>
</And>
</Or>
</Or>
This is my query works fine with CAML query builder but in SPQuery it does not return any record. I have tried by providing ViewAttributes to "RecursiveAll". What is wrong with given code?
I have solved this error by my own.
I have removed Inbuilt function like today and now with my own value from code side.
Microsoft.SharePoint.Utilities.SPUtility.CreateISO8601DateTimeFromSystemDateTime(
DateTime.Now.AddMonths(-1))
More Complete Sample
string queryString_getPersonalAlerts = string.Format(#"<Where><Or>
<And><Eq><FieldRef Name='{0}' />
<Value Type='Choice'>Daily</Value></Eq><And><Geq><FieldRef Name='{1}' />
<Value Type='DateTime'>{2}</Value></Geq><And><Geq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{2}</Value></Geq><Leq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{3}</Value></Leq></And></And></And><Or><And><Eq><FieldRef Name='{0}' />
<Value Type='Choice'>Weekly</Value></Eq><And><Eq><FieldRef Name='{1}' />
<Value Type='DateTime'>{4}</Value></Eq><And><Geq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{4}</Value></Geq><Leq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{5}</Value></Leq></And></And></And><And><Eq><FieldRef Name='{0}' />
<Value Type='Choice'>Monthly</Value></Eq><And><Eq><FieldRef Name='{1}' />
<Value Type='DateTime'>{6}</Value></Eq><And><Geq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{6}</Value></Geq><Leq><FieldRef Name='{1}' />
<Value IncludeTimeValue='TRUE' Type='DateTime'>{7}</Value></Leq></And></And></And></Or></Or></Where>",
PersonalAlerts.Fields.DeliveryFrequency.ToString(),
PersonalAlerts.Fields.LastDeliveryTime.ToString(),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddDays(-1)),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddDays(-1).AddMinutes(60)),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddDays(-7)),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddDays(-7).AddMinutes(60)),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddMonths(-1)),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Now.AddMonths(-1).AddMinutes(60)));

Using IN Element with other Elements in SPQuery

I'm trying to retrieve items from list using this Query:
query.Query =
#"<Where>
<And>
<And>
<Geq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateFrom) + #"</Value>
</Geq>
<Leq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateTo) + #"</Value>
</Leq>
</And>
<In>
<FieldRef Name='Employee' LookupId='TRUE' />
<Values>
<Value Type='int'>1</Value>
<Value Type='int'>3</Value>
</Values>
</In>
</And>
</Where>";
On runtime i get the following exception:
SPException: One or more field types are not installed properly. Go to the list settings page to delete these fields
on line List.GetItems(query).
If i modify SPQuery like this:
query.Query =
#"<Where>
<And>
<Geq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateFrom) + #"</Value>
</Geq>
<Leq>
<FieldRef Name='Date' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateTo) + #"</Value>
</Leq>
</And>
</Where>";
or this:
query.Query =
#"<Where>
<In>
<FieldRef Name='Employee' LookupId='TRUE' />
<Values>
<Value Type='int'>1</Value>
<Value Type='int'>3</Value>
</Values>
</In>
</Where>";
everything is working perfectly.
The problem was in reusing SPQuery object, surprisingly. So I create a new SPQuery and everything is OK.

Adding Gantt Chart view to custom list template in XML. <ViewData> not deploying

In a Sharpoint 2010 project, I have a custom content type, which inherits the standard Task content type, and a custom list template, with items of this content type (everything is done in XML and code, not 'clicked-through').
I would like to add a Gantt chart to my list. I can do it using the web interface but I would like to have it in code. So I have done it manually, opened Sharepoint Manager, previewed the view schema and, with minor but necessary modifications, copied it to my list schema. So I ended up with a view which looks more less like this:
<View WebPartZoneID="Main" Type="GANTT" DisplayName="Gantt Chart" Url="gantt.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/issues.png" SetupPath="pages\viewpage.aspx">
<Query>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="Attachments" />
<FieldRef Name="ID" />
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkTitle" />
<FieldRef Name="AssignedTo" />
<FieldRef Name="Status" />
<FieldRef Name="Priority" />
<FieldRef Name="StartDate" />
<FieldRef Name="DueDate" />
<FieldRef Name="MyCustomField" />
<!-- other FieldRefs for my custom fields -->
</ViewFields>
<ViewData>
<FieldRef Name="StartDate" Type="GanttStartDate" />
<FieldRef Name="DueDate" Type="GanttEndDate" />
<FieldRef Name="Title" Type="GanttTitle" />
<FieldRef Name="PercentComplete" Type="GanttPercentComplete" />
<FieldRef Name="Predecessors" Type="GanttPredecessors" />
</ViewData>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
</View>
But this doesn't work. The view is visible on the list, but when I open it, a blank page appears. Because of some reason, when I preview my custom view in Sharepoint Manager the <ViewData> tag is not there. I may add this tag manually in Sharepoint Manager and then the view magically starts to work. However, the tag, because of some reason, is not deployed with the rest of the view.
Any suggestions as to how to make the tag deploy?
I am not sure what is wrong in your declaration but i was able to add working defininition to schema. Here it is my definition:
<View BaseViewID="9" Type="GANTT" WebPartZoneID="Main" DisplayName="Gantt view" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/issues.png" Url="Gantt.aspx" ReqAuth="TRUE">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitle" />
<FieldRef Name="AssignedTo" />
<FieldRef Name="TaskGroup" />
<FieldRef Name="Status" />
<FieldRef Name="Priority" />
<FieldRef Name="DueDate" />
<FieldRef Name="PercentComplete" />
<FieldRef Name="Predecessors" />
<FieldRef Name="Comments" />
</ViewFields>
<ViewData>
<FieldRef Name="StartDate" Type="GanttStartDate"/>
<FieldRef Name="DueDate" Type="GanttEndDate"/>
<FieldRef Name="Title" Type="GanttTitle"/>
<FieldRef Name="PercentComplete" Type="GanttPercentComplete"/>
<FieldRef Name="Predecessors" Type="GanttPredecessors"/>
</ViewData>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
</ParameterBindings>
<Query>
<OrderBy>
<FieldRef Name="Title"></FieldRef>
</OrderBy>
</Query>
</View>
Just note that BaseViewID should be unique in scope and I dont use ContentTypeID.
Also Computed and calculated fields doenot working here so you should create new simple text field and populate them in event recievers.

Deploy 3 ContentTypes using 1 Feature - Only 2 gets deployed

I have a feature which has following manifest file that defines multiple content types:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01008e5736f1388b4809a9f102da1e573ddb"
Name="$Resources:Balticovo,ContentType_AgendaName"
Group="$Resources:core,CustomContentTypesGroup"
Description="$Resources:Balticovo,ContentType_AgendaDescription"
Version="1">
<FieldRefs>
<!-- Jautājumu pacēla-->
<FieldRef ID="{31b28519-c87e-4e0d-9c1b-d02c5e034cf9}" />
<!-- Kam piešķirts -->
<FieldRef ID="{53101f38-dd2e-458c-b245-0c236cc13d1a}" />
<!-- Saistītās personas -->
<FieldRef ID="{E5C80D9B-4E09-4457-A6A9-5A6F574DEDA5}" />
<!-- Komentāri -->
<FieldRef ID="{6df9bd52-550e-4a30-bc31-a4366832a87f}" />
<!-- Izpildīt līdz -->
<FieldRef ID="{cd21b4c2-6841-4f9e-a23a-738a65f99889}" />
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>AgendaToTaskOnAdd</Name>
<Type>ItemAdded</Type>
<SequenceNumber>10000</SequenceNumber>
<Assembly>Balticovo.SharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5</Assembly>
<Class>Balticovo.SharePoint.AgendaToTask</Class>
<Data></Data>
<Filter></Filter>
</Receiver>
<Receiver>
<Name>AgendaToTaskOnUpdate</Name>
<Type>ItemUpdating</Type>
<SequenceNumber>10000</SequenceNumber>
<Assembly>Balticovo.SharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5</Assembly>
<Class>Balticovo.SharePoint.AgendaToTask</Class>
<Data></Data>
<Filter></Filter>
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
<ContentType ID="0x0100AD4DFC626A3F4db492A4FCF91B0E47A0"
Name="$Resources:Balticovo,ContentType_ReglarAttendeeName"
Group="$Resources:core,CustomContentTypesGroup"
Description="$Resources:Balticovo,ContentType_ReglarAttendeeDescription"
Version="1">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Required="FALSE" Hidden="TRUE" />
<FieldRef ID="{37D4FF81-9DE1-436a-B270-923E93258507}" />
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>AddAttendeeToCurrentMeeting</Name>
<Type>ItemAdded</Type>
<SequenceNumber>10000</SequenceNumber>
<Assembly>Balticovo.SharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5</Assembly>
<Class>Balticovo.SharePoint.RegularAttendeesEventReceiver</Class>
<Data></Data>
<Filter></Filter>
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
<ContentType ID="0x01008606FC8499F9407b83AF3DBAD6865F58"
Name="$Resources:Balticovo,ContentType_WebApplicationQueryName"
Group="$Resources:core,CustomContentTypesGroup"
Description="$Resources:Balticovo,ContentType_WebApplicationQueryDescription"
Version="1">
<FieldRefs>
<FieldRef ID="{acbe30d6-ea25-40a2-b6e5-9df76e9c881e}" />
<FieldRef ID="{6c732395-7404-4ad4-9b03-50195b70c006}" />
<FieldRef ID="{cb16a530-21ca-43b1-b270-dbb33fa3f7a7}" />
<FieldRef ID="{bd94a837-82ab-4a8b-b7df-9978cd35f9ec}" />
<FieldRef ID="{c05e3059-b1fc-4116-8f7d-1cfde24b96f4}" />
<FieldRef ID="{32fb6f25-cf6e-4e9c-8244-137d017c9348}" />
<FieldRef ID="{e42ca75d-f017-4eb7-91a6-236dfd71017a}" />
<FieldRef ID="{EAA39077-D6AF-464e-8052-9001B4E99834}" />
</FieldRefs>
</ContentType>
</Elements>
So, there are 3 CT's, however first one doesn't deploy. It's not hidden, because when checking SPWeb.AvailableContentTypes - there is no such CT available.
ID of CType is Unique.
Receiver classes are publicly
available.
Referencing fields are also
available.
Trying this on a fresh web application.
Oh, what could be wrong?
Solved.
Those <!-- --> comments between tags prevented this content type to be deployed.

Resources