I'm trying to get data from a Sharepoint list and put it into some Flex graphs. I can call the list data just fine using a CAML query, but I want to use a GroupBy to consolidate the rows by Teams. So, for example Team 1 may have 20 records, Team 2 may have 8 records, and Team 3 might have 25 records... Instead of showing 53 records, I want to show 3... just "Team 1, Team 2, Team 3" and the sum of the cost of each entry.
I see where CAML provides a GroupBy element, but I can't seem to get it to work. Also, I was only able to get the OrderBy element to work when I used the OrderField element instead of the FieldRef element like 90% of the books and websites recommend. If I do use FieldRef, OrderBy doesn't work anymore, which makes no sense to me. Something must be awry...
Here is my CAML Query as it stands...
---------------------------------------------------
<queryRequest xmlns="http://schemas.microsoft.com/sharepoint/dsp">
<dsQuery resultContent="dataOnly" resultRoot="Rows" resultRow="Row" columnMapping="attribute">
<ViewFields>
<FieldRef Name="Team"></FieldRef>
<FieldRef Name="Cost"></FieldRef>
<FieldRef Name="EANo"></FieldRef>
</ViewFields>
<Query>
<GroupBy collapse="true">
<FieldRef Name="Team"/>
</GroupBy>
<OrderBy>
<OrderField Name="Cost"/>
</OrderBy>
</Query>
</dsQuery>
</queryRequest>
---------------------------------------------------
This is with OrderBy working, but GroupBy not working. Help!
Thanks!
I ran the following query and seems to be working fine for me.
<Query>
<GroupBy collapse="true">
<FieldRef Name='Date' />
</GroupBy>
<OrderBy>
<FieldRef Name='Title' />
</OrderBy>
</Query>
I suggest you use the U2U CAML Query Builder tool to build and test your query's
Related
I have implemented Solr Search and its working good to some extent. I want to implement search similar to IMDB. I have added the phonetic algorithm filter in Solr. It work for some use cases as follow
Good Use Case
Query: "Silvertor Stallon"
Result: "Slyvestor Stallone"
Query: "Angelena Jole"
Result: "Angelina Jolie"
Bad Use Case
Query: Anglina Jolie
Result: [] # Empty Array. While as I mentioned above I have Angelina Jolie in Database.
Can someone please guide me what is the problem or why Solr not finding "Anglina"
Here is my Solr configuration
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="20" side="front"/>
<filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
</analyzer>
</fieldType>
More Details:
Its a Rails project and i have used Sunspot for interaction with Solr.
Looking forward a great help. Thanks
You should really be using Solr Admin UI's Analyze screen. There, you can choose your field, put your source text and your search text and see what happens and whether they match.
In your specific case, I suspect that you cannot combine EdgeNGramFilterFactory and PhoneticFilterFactory. You will get random prefixes of text and then you try to derive phonetic information. Also, EdgeNGramFilterFactory is usually on the indexing side only and you see to be using the same definition for both indexing and query time.
I'm starting with Oracle ADF and JDeveloper. I'm doing some basic tutorials first.
From the HR database schema, I'm trying this exercise: create a new location, but in CountryId attribute, show all countries list.
This is more user-friendly, so the user can select Italy instead of typing IT .
For this, I'm doing this steps:
In Locations view , choose CountryId attribute and create a LOV. This one must read from CountriesView1, with value CountryId attribute, and show CountryName attribute.
Drop LocationsView1 in a page and select ADF Form.
Select CountryId as a combo box.
Drop Create operation from LocationsView1 as a button.
Drop Commit operation as a button.
When running this page, I see all country names, but when I choose one of them, it does not show me it as selected, and, when commit the new data, CountryId is inserting with null value.
Obviously, I'm doing something in a wrong way. How can I do this simple form, with CountryId as a list?
Can anyone help me, please?
Thanks in advance. Best regards
EDIT: code of dataEntry.jspx
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" binding="#{backingBeanScope.backing_dataEntry.d1}">
<af:messages binding="#{backingBeanScope.backing_dataEntry.m1}" id="m1"/>
<af:form id="f1" binding="#{backingBeanScope.backing_dataEntry.f1}">
<af:panelStretchLayout id="psl1"
binding="#{backingBeanScope.backing_dataEntry.psl1}">
<f:facet name="center">
<af:panelFormLayout binding="#{backingBeanScope.backing_dataEntry.pfl1}"
id="pfl1">
<af:panelFormLayout binding="#{backingBeanScope.backing_dataEntry.pfl2}"
id="pfl2">
<af:inputText value="#{bindings.LocationId.inputValue}"
label="#{bindings.LocationId.hints.label}"
required="#{bindings.LocationId.hints.mandatory}"
columns="#{bindings.LocationId.hints.displayWidth}"
maximumLength="#{bindings.LocationId.hints.precision}"
shortDesc="#{bindings.LocationId.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.it1}"
id="it1">
<f:validator binding="#{bindings.LocationId.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.LocationId.format}"/>
</af:inputText>
<af:inputText value="#{bindings.StreetAddress.inputValue}"
label="#{bindings.StreetAddress.hints.label}"
required="#{bindings.StreetAddress.hints.mandatory}"
columns="#{bindings.StreetAddress.hints.displayWidth}"
maximumLength="#{bindings.StreetAddress.hints.precision}"
shortDesc="#{bindings.StreetAddress.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.it2}"
id="it2">
<f:validator binding="#{bindings.StreetAddress.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.PostalCode.inputValue}"
label="#{bindings.PostalCode.hints.label}"
required="#{bindings.PostalCode.hints.mandatory}"
columns="#{bindings.PostalCode.hints.displayWidth}"
maximumLength="#{bindings.PostalCode.hints.precision}"
shortDesc="#{bindings.PostalCode.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.it3}"
id="it3">
<f:validator binding="#{bindings.PostalCode.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.City.inputValue}"
label="#{bindings.City.hints.label}"
required="#{bindings.City.hints.mandatory}"
columns="#{bindings.City.hints.displayWidth}"
maximumLength="#{bindings.City.hints.precision}"
shortDesc="#{bindings.City.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.it4}"
id="it4">
<f:validator binding="#{bindings.City.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.StateProvince.inputValue}"
label="#{bindings.StateProvince.hints.label}"
required="#{bindings.StateProvince.hints.mandatory}"
columns="#{bindings.StateProvince.hints.displayWidth}"
maximumLength="#{bindings.StateProvince.hints.precision}"
shortDesc="#{bindings.StateProvince.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.it5}"
id="it5">
<f:validator binding="#{bindings.StateProvince.validator}"/>
</af:inputText>
<af:inputListOfValues id="countryIdId"
popupTitle="Search and Select: #{bindings.CountryId.hints.label}"
value="#{bindings.CountryId.inputValue}"
label="#{bindings.CountryId.hints.label}"
model="#{bindings.CountryId.listOfValuesModel}"
required="#{bindings.CountryId.hints.mandatory}"
columns="#{bindings.CountryId.hints.displayWidth}"
shortDesc="#{bindings.CountryId.hints.tooltip}"
binding="#{backingBeanScope.backing_dataEntry.countryIdId}">
<f:validator binding="#{bindings.CountryId.validator}"/>
</af:inputListOfValues>
<af:commandButton actionListener="#{bindings.Create.execute}"
text="Create"
disabled="#{!bindings.Create.enabled}"
binding="#{backingBeanScope.backing_dataEntry.cb1}"
id="cb1"/>
<af:commandButton actionListener="#{bindings.Commit.execute}"
text="Commit"
disabled="#{!bindings.Commit.enabled}"
binding="#{backingBeanScope.backing_dataEntry.cb2}"
id="cb2"/>
</af:panelFormLayout>
</af:panelFormLayout>
<!-- id="af_one_column_stretched" -->
</f:facet>
</af:panelStretchLayout>
</af:form>
</af:document>
</f:view>
<!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_dataEntry-->
</jsp:root>
Well, I did it!
The steps are:
Drop LocationsView1 in a page and select ADF Form...
Drop Create operation from LocationsView1 as a button.
Drop Commit operation as a button
Remove CountryId input text
(Re)Drop CountryId from LocationsView1. When JDeveloper asks, choose Select One
Choice...
In Bindings section, select CountryId and edit (pen icon)
Choose Dynamic List radio button and CountriesView1 in
ListDataSource combo
Match CountryId from Data Value with CountryId List attribute. Select CountryName in the below section.
Well, finally, all countries from COUNTRIES table are listed, and data are inserted into LOCATIONS table.
I hope this will be useful.
Regards
I need to list all the files located in one document library that match a specific naming convention: The documents to retrieve are all in the form 'Report xxxx-xx-xx'.
I have to use the GetListItems web service.
Is there a way to collect all these documents in one call?
How to write the 'where' section in the query part?
Can I use some regex in this?
Thanks
Reading
http://msdn.microsoft.com/en-us/library/ms471093(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/ms414805(v=office.12).aspx
the construction of a WHERE clause seems clear:
<Query>
<Where>
<Geq>
<FieldRef Name="Expires"/>
<Value Type="DateTime">
<Today/>
</Value>
</Geq>
</Where>
<OrderBy>
<FieldRef Name="Modified"/>
</OrderBy>
</Query>
However there does not seem to be a way to use regexes. Perhaps the best you can do is to use the BeginsWith element on the "Report" and Contains element to search for a dash. There is a good example for this at
http://msdn.microsoft.com/en-us/library/ms196501(v=office.12).aspx
Perhaps you could add a Calculated Column on your document library, that performs a string manipulation and/or test operation on your title text, and returns eg something that can then easily be picked up in your where clause?
This might help limit the result set at the server side...
=IF(LEFT([TitleColumn],7)="Report ", if(ISNUMBER(DATEVALUE(RIGHT([TitleColumn],10))), "TRUE", "FALSE"), "FALSE")
Refer to Microsoft's Calculated Field Formulas for what's available in calculated columns.
I need help on searching attachments i.e Word Document, PDF etc which are attached to the list during inserting Item in SharePoint 2010 using CAML queries.
I tried with this query
<Query>
<Where>
<Eq>
<FieldRef Name="Attachments" />
<Value Type="Attachments">WordDocument1.docx</Value>
</Eq>
</Where>
</Query>
im not able to get any results if i give this query.
Please help.
The problem here is that the Attachments field of a SharePoint list does not store the attachments itself. This column only return whether a certain list item has an attachment or
not.
The attachments are not stored in a SharePoint list. Therefore I don't think it's possible to retrieve them with a CAML query.
If a query the SharePoint Web Service Search, is there a way to send a parameter so that it only return documents?
There is of course the possibility to filter the result using the isDocument column, but is it possible during the query?
What do you mean by "during the query"? Providing a filter on the IsDocument column is applied query time! This is one way to return documents - another could be to create a search scope for documents only. But again, you will need to specify it in the query.
I guess you can use the beginsWith filhter in the query and query for all items that begins with a documente content type id:
<Where>
<BeginsWith>
<FieldRef Name='contentTypeId'/>
<Value Type='Text'>0x0101</Value>
</BeginsWith>
</Where>
see here for information about content type id and here is how you can use the query.