Caml Validation - sharepoint-2013

Is this is a ligit Caml query? I am new to sharepoint.
<View>
<Query>
<Where>
<And>
<Eq>
<FieldRef Name="Autres_x0020_organizations"/>
<Value Type="Boolean">1</Value>
</Eq>
<EQ>
<FieldRef Name="TempPartiel"/>
<Value Type="Boolean">1</Value>
</EQ>
<Or>
<IsNull>
<FieldRef Name="Date_x0020_d_x0027__x00e9_ch_x00"/>
</IsNull>
<Geq>
<FieldRef Name="Date_x0020_d_x0027__x00e9_ch_x00"/>
<Value Type="DateTime">
<Today/>
</Value>
</Geq>
</Or>
</And>
</Where>
<OrderBy>
<FieldRef Name="Ordre_x0020_des_x0020_bourses" Ascending="TRUE"/>
</OrderBy>
</Query>
</View>
I know that my new column in my list is a Yes/No type.
I added this sections
<EQ>
<FieldRef Name="TempPartiel"/>
<Value Type="Boolean">1</Value>
</EQ>

The caml query looks fine. Besides, here is a tool called Caml Designer would help you to build your caml query. It's very useful:
https://www.biwug.be/resources

Related

SharePoint 2013 Content Query Web Part 4 Filter

I have the following Code-Snippet to Filter Blogposts in a Content Query WebPart. We need more than the 3 Filters already given in Sharepoint, so I tried it with CMAL-Query.
But the filter´s don´t apply when I add the WebPart to my SP-Page. Any Suggestions how to Change the code?
The Posts should be filtered by Category.
<property name="QueryOverride" type="string">
<![CDATA[
<where>
<or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test4</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test5</Value>
</Eq>
</or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Ideen</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Meinungen</Value>
</Eq>
</or>
</or>
</where>
]]>
</property>
NVM.
I found my mistake. Using the U2U Caml Builder everything now works as expected.

how to refer outputfield from derivedfield in pmml

I have derivedfields in my pmml I want to use them as outputfields. So I want to refer outputfield from derivedfield. But sas application throw an error. Error is :
ERROR: Variable Z_DD_OCCUPATION_ID is not defined.
How can I set outputfield from derived field?
Here is my pmml which doesn't work
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<PMML version="4.2"
xmlns="http://www.dmg.org/PMML-4_2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header copyright="Copyright(c) 2002 SAS Institute Inc., Cary, NC, USA. All Rights Reserved.">
<Application name="SAS(r)" version="9.4"/>
<Timestamp>2016-06-23 15:36:04</Timestamp>
</Header>
<DataDictionary numberOfFields="26">
<DataField name="CH_INT_FLG_CRR" optype="continuous" dataType="double"/>
<DataField name="TD_SALE_FLG_00M_5" optype="categorical" dataType="string"/>
<DataField name="TARGET_NUM" optype="categorical" dataType="double"/>
</DataDictionary>
<TransformationDictionary>
</TransformationDictionary>
<RegressionModel functionName="classification" targetFieldName="TARGET_NUM" normalizationMethod="logit">
<MiningSchema>
<MiningField name="CH_INT_FLG_CRR" usageType="active" optype="continuous"/>
<MiningField name="TD_SALE_FLG_00M_5" usageType="active" optype="categorical"/>
<MiningField name="TARGET_NUM" usageType="target" optype="categorical"/>
</MiningSchema>
<Output>
<OutputField name="I_TARGET_NUM" displayName="Into: TARGET_NUM" optype="categorical" dataType="string" targetField="TARGET_NUM" feature="predictedValue"/>
<OutputField name="U_TARGET_NUM" displayName="Unnormalized Into: TARGET_NUM" optype="categorical" dataType="string" targetField="TARGET_NUM" feature="predictedDisplayValue"/>
<OutputField name="P_TARGET_NUM1" displayName="Predicted: TARGET_NUM=1" optype="continuous" dataType="double" targetField="TARGET_NUM" feature="probability" value="1"/>
<OutputField name="P_TARGET_NUM0" displayName="Predicted: TARGET_NUM=0" optype="continuous" dataType="double" targetField="TARGET_NUM" feature="probability" value="0"/>
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_DD_OCCUPATION_ID"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_CH_INT_FLG_CRR"/>
</OutputField>
</Output>
<Targets>
<Target field="TARGET_NUM" optype="categorical">
<TargetValue value="1" displayValue="1" priorProbability="0.5000049143"/>
<TargetValue value="0" displayValue="0" priorProbability="0.4999950857"/>
</Target>
</Targets>
<LocalTransformations>
<DerivedField name="Z_DD_OCCUPATION_ID" displayName="Z_DD_OCCUPATION_ID" optype="continuous" dataType="double" >
<MapValues outputColumn="return" defaultValue="99.9">
<FieldColumnPair column="condition" field="TD_SALE_FLG_00M_5"/>
<InlineTable>
<row>
<condition>9999</condition>
<return>-0.0992686543837357</return>
</row>
<row>
<condition>7130</condition>
<return>-0.010300374749499</return>
</row>
</InlineTable>
</MapValues>
</DerivedField>
<DerivedField name="Z_CH_INT_FLG_CRR" displayName="Z_CH_INT_FLG_CRR" optype="continuous" dataType="double">
<Discretize field="CH_INT_FLG_CRR" >
<DiscretizeBin binValue="0.0154213834">
<Interval closure="openOpen" rightMargin="0"/>
</DiscretizeBin>
<DiscretizeBin binValue="-0.025845983">
<Interval closure="closedClosed" leftMargin="0" rightMargin="0"/>
</DiscretizeBin>
<DiscretizeBin binValue="0.0154213834">
<Interval closure="openOpen" leftMargin="0"/>
</DiscretizeBin>
</Discretize>
</DerivedField>
</LocalTransformations>
<RegressionTable intercept="0.0203226371" targetCategory="1">
<NumericPredictor name="Z_CH_INT_FLG_CRR" coefficient="7.5086455767" />
<NumericPredictor name="Z_DD_OCCUPATION_ID" coefficient="3.2" />
</RegressionTable>
<RegressionTable intercept="0" targetCategory="0"/>
</RegressionModel>
</PMML>
If I use datadictionary columns instead of derived fields, it works perfectly.
For example If I convert
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_DD_OCCUPATION_ID"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_CH_INT_FLG_CRR"/>
</OutputField>
to
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="TD_SALE_FLG_00M_5"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="CH_INT_FLG_CRR"/>
</OutputField>
it works. Because in this case, I refer outputfield from datadictionary columns. But actually I need to use derivedfields in outputfields. How can I refer outputfields from derivedfields?
You need to move your derived fields from LocalTransformations (ie. local scope) to TransformationDictionary (ie. global scope).
PMML 4.2 does not permit referencing local derived fields from output fields. The "logic" is that you cannot reference a field before it has been seen by the PMML parser. In you example, OutputField#name=out_1 element occurs before DerivedField#name=Z_DD_OCCUPATION_ID element.
PMML 4.3 relaxed this rule. See http://mantis.dmg.org/view.php?id=142 for details.

Not able to add columns to Document Library from Visual Studio template

I am trying to create new document library from SharePoint project template from Visual Studio 2015.
While doing so I am able to create Document Library Template and Instance. Also if I deploy solution to one of my site it creates list as well. Strange thing is if I add a column to the template and then deploy it creates the list but does not create new custom column.
Below is the schema file for the template.
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="SharedDocuments" Direction="$Resources:Direction;" Url="SharedDocuments" BaseType="1" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
<MetaData>
<ContentTypes>
<ContentType ID="0x0101000dba2955561e4de0a115152637e9f8e2" Name="ListFieldsContentType">
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
<FieldRef ID="{4b1bf6c6-4f39-45ac-acd5-16fe7a214e5e}" Name="TemplateUrl" />
<FieldRef ID="{cd1ecb9f-dd4e-4f29-ab9e-e9ff40048d64}" Name="xd_ProgID" />
<FieldRef ID="{fbf29b2d-cae5-49aa-8e0a-29955b540122}" Name="xd_Signature" />
<FieldRef ID="{e52012a0-51eb-4c0c-8dfb-9b8a0ebedcb6}" Name="Combine" />
<FieldRef ID="{5d36727b-bcb2-47d2-a231-1f0bc63b7439}" Name="RepairDocument" />
<FieldRef ID="{8f838bdc-4b95-4b26-b86f-3025d2df964f}" Name="TestColumn" />
</FieldRefs>
</ContentType>
<ContentTypeRef ID="0x0101">
<Folder TargetName="Forms/Document" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
</ContentTypes>
<Fields>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" ShowInNewForm="FALSE" ShowInFileDlg="FALSE" DisplayName="$Resources:core,Title;" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title"></Field>
<Field ID="{4b1bf6c6-4f39-45ac-acd5-16fe7a214e5e}" Type="Text" Name="TemplateUrl" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Template_Link;" XName="TemplateUrl" Filterable="TRUE" Sortable="TRUE" Hidden="TRUE" FromBaseType="TRUE" PITarget="mso-infoPathSolution" PIAttribute="href" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="TemplateUrl"></Field>
<Field ID="{cd1ecb9f-dd4e-4f29-ab9e-e9ff40048d64}" Type="Text" Name="xd_ProgID" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Html_File_Link;" XName="ProgID" Filterable="TRUE" Sortable="TRUE" Hidden="TRUE" FromBaseType="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="xd_ProgID"></Field>
<Field ID="{fbf29b2d-cae5-49aa-8e0a-29955b540122}" Type="Boolean" Group="_Hidden" Name="xd_Signature" DisplaceOnUpgrade="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="xd_Signature" DisplayName="$Resources:core,Xml_signed;" XName="{FBF29B2D-CAE5-49aa-8E0A-29955B540122}" Filterable="TRUE" Sortable="TRUE" Sealed="TRUE" Hidden="TRUE" FromBaseType="TRUE" ReadOnly="TRUE"></Field>
<Field ID="{e52012a0-51eb-4c0c-8dfb-9b8a0ebedcb6}" ReadOnly="TRUE" Type="Computed" Name="Combine" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Merge;" Filterable="FALSE" Sortable="FALSE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Combine">
<FieldRefs>
<FieldRef Name="FSObjType" Key="Primary" />
<FieldRef Name="EncodedAbsUrl" />
<FieldRef Name="TemplateUrl" />
</FieldRefs>
</Field>
<Field ID="{5d36727b-bcb2-47d2-a231-1f0bc63b7439}" ReadOnly="TRUE" Type="Computed" Name="RepairDocument" DisplaceOnUpgrade="TRUE" DisplayName="$Resources:core,Relink;" Filterable="FALSE" Sortable="FALSE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="RepairDocument">
<FieldRefs>
<FieldRef Name="FSObjType" Key="Primary" />
<FieldRef Name="ID" />
</FieldRefs>
</Field>
<Field Name="TestColumn" ID="{8f838bdc-4b95-4b26-b86f-3025d2df964f}" DisplayName="TestColumn" Type="Text" />
</Fields>
<Views>
--Removed--
</Views>
<Forms>
<Form Type="DisplayForm" SetupPath="pages\form.aspx" Url="Forms/DispForm.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" SetupPath="pages\form.aspx" Url="Forms/EditForm.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main" />
--Removed--
</Forms>
</MetaData>
</List>
When you upload a document in a Document Library there's an option for you to choose the Content Type, choose your custom Content Type and you'll see the fields you defined.

flow in model-glue event handler

Can any body help me to understand the flow of model-glue event handler......its so confusing or simplify bellow code......
<event-handler name="Shipment.List" type="templatedPage">
<broadcasts>
<message name="needShipmentList" />
</broadcasts>
<views>
<include name="Primary" template="List.Shipment.cfm">
<value name="xe_Display" value="Shipment.Display" />
<value name="xe_Form" value="Shipment.Form" />
</include>
</views>
</event-handler>
<event-handler name="Shipment.Display" type="templatedPage">
<broadcasts>
<message name="needShipmentDetail" />
</broadcasts>
<views>
<include name="primary" template="Display.Shipment.cfm">
<value name="xe_ShipmentList" value="Shipment.List" />
<value name="xe_ItemForm" value="Item.Form" />
<value name="xe_ShipmentDisplay" value="Shipment.Display" />
<value name="xe_ItemRemove" value="doItem.Remove" />
</include>
</views>
</event-handler>
When you call for event "Shipment.List", it will broadcasts "needShipmentList" function of ShipmentController, after execution it will return on List.Shipment.cfm from on "Primary" layout of master page.
"List.Shipment.cfm" has a link whicj is triggered for needShipmentDetail function
"List.Shipment.cfm" fatches values from "Shipment.Display"-->needShipmentDetail
on display page(Display.Shipment.cfm), there are some links for remove, for listing...etc
"xe" is a convention for eXit Events

Any obvious flaws in this CAML Query?

I am querying a sharepoint list via the web service api. Calling the service through the API requires sending an XmlNode object that represent the CAML query. With everything else exactly the same, these are two different queries I'm attempting to send (obtained via the XmlNode's InnerXml property right before they are sent to the API):
<!-- This one works fine -->
<Query>
<Where>
<Eq>
<FieldRef Name="ID" />
<Value Type="Text">304</Value>
</Eq>
</Where>
</Query>
<!-- This one fails with a Soap exception (which I've seen before when searching
for an invalid field, but the first one calls the exact same field). -->
<Query>
<Where>
<In>
<FieldRef Name="ID" />
<Values>
<Value Type="Text">304</Value>
<Value Type="Text">303</Value>
<Value Type="Text">302</Value>
<Value Type="Text">301</Value>
</Values>
</In>
</Where>
</Query>
I'm new to CAML queries, so perhaps I'm missing something obvious about how In statements work, but all the examples I've viewed seem to have this exact format.
Which version of SharePoint are you using ? The IN element seems to be valid only in SharePoint 2010. (According to this article: http://www.lushpedia.com/post/Alternative-of-In-Clause-for-CAML-Query-for-SharePoint-2007.aspx)