Need help in sharepoint sharepoint list Item ID field - sharepoint-2010

Requesting to check the below code:
<Method ID="1" Cmd="Update">
<Field Name="ID">4<Field>
<Field Name="Field_Name">Value</Field></Method>
<Method ID="2" Cmd="New"><Field Name="ID" >6</Field>
<Field Name="Field_Name">Value</Field></Method>
<Method ID="3" Cmd="Update">
<Field Name="ID" >8</Field>
<Field Name="Field_LookUp_Name">ID</Field>
</Method>
<Method ID="4" Cmd="Delete">
<Field Name="ID" >16</Field>
<Field Name="Field_Name">Value</Field>
</Method>
The above code I got from MSDN site, in the explanation Field Name="ID" is nothing but list Item ID. Based on what or how they are getting above field Name ID like: 4, 6, 8 16......Please somebody help me I am not understanding.

Field Name="ID" is the auto-generated unique item id for each and every item added to the list.
Whenever you enter any new item to list sharepoint automatically assigns unique ID to list item.
Regards.

Related

SOLR order/display response fields list in specific way when JSON call?

I have a question about SOLR response fields when JSON response format is obtained.
I have a Web service returning more than 20 fields and they are ordered by default as first the fields having data and after that all other fields.
My question is there a way to precise the order of the fields list, so that we obtain them always in same order ?
Example if I have the fields FIELD 1, FIELD 2, etc, I want that I preserve exactly this order and not FIELD 2, FIELD 1.
Thanks
yes you can precise the order editing the "data-config.xml" , here as you can see are declared all fields and on top are are the corresponding query , delta imports and full import . try to change the fields order in query and declaration in bottom,
example :
<dataConfig>
<dataSource type="HttpDataSource" />
<document>
<entity name="slashdot"
pk="link"
url="http://rss.slashdot.org/Slashdot/slashdot"
processor="XPathEntityProcessor"
forEach="/RDF/channel | /RDF/item"
transformer="DateFormatTransformer">
<field column="source" xpath="/RDF/channel/title" commonField="true" />
<field column="source-link" xpath="/RDF/channel/link" commonField="true" />
<field column="subject" xpath="/RDF/channel/subject" commonField="true" />
<field column="title" xpath="/RDF/item/title" />
<field column="link" xpath="/RDF/item/link" />
<field column="description" xpath="/RDF/item/description" />
<field column="creator" xpath="/RDF/item/creator" />
<field column="item-subject" xpath="/RDF/item/subject" />
<field column="slash-department" xpath="/RDF/item/department" />
<field column="slash-section" xpath="/RDF/item/section" />
<field column="slash-comments" xpath="/RDF/item/comments" />
<field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" />
</entity>
</document>

Filter on one2many_list widget and context passing

I have 2 one2many fields that are represented by one2many_list widget. The fields are:
documents_applicant_1 = fields.One2many(comodel_name='application.documents',
documents_applicant_2 = fields.One2many(comodel_name='application.documents',
inverse_name='application_id')
<group>
<field name="documents_applicant_1" widget="one2many_list"
nolabel="1">
<tree string="Variants" editable="bottom">
<field name="name" />
<field name="document_raw_data" id="document_raw_data_applicant_1" />
<!-- <field name="category" /> -->
</tree>
</field>
</group>
<group>
<field name="documents_applicant_2" widget="one2many_list"
nolabel="1">
<tree string="Variants" editable="bottom">
<field name="name" />
<field name="document_raw_data" id="document_raw_data_applicant_2" />
<!-- <field name="category" /> -->
</tree>
</field>
</group>
When the user adds records using those fields, depending on the list he uses to add a record, I want to pass a context. My layout is the following:
Now besides wanting to pass a different context when my user adds records to the left list and the right one, I want to apply a dynamic filter on the records shown on both the lists.
How can the above be achieved?
I do not wish to write javascript rather than use existing funtionality
You can add the domain you want to the One2many fields in Python code (in XML that is not going to work). And then, in XML, you can add the context using the prefix default_.
I put you an example:
Suppose you want documents_applicant_1 field for adding records
whose category is 'A', and documents_applicant_2 field for adding
records whose category is 'B'.
Then you can write:
Python code
documents_applicant_1 = fields.One2many(
comodel_name='application.documents',
inverse_name='application_id',
domain=[('category' '=', 'A')],
)
documents_applicant_2 = fields.One2many(
comodel_name='application.documents',
inverse_name='application_id',
domain=[('category' '=', 'B')],
)
XML code
<group>
<field name="documents_applicant_1" widget="one2many_list"
nolabel="1" context={'default_category': 'A', }>
<tree string="Variants" editable="bottom">
<field name="name" />
<field name="document_raw_data" id="document_raw_data_applicant_1" />
<field name="category" />
</tree>
</field>
</group>
<group>
<field name="documents_applicant_2" widget="one2many_list"
nolabel="1" context={'default_category': 'B', }>
<tree string="Variants" editable="bottom">
<field name="name" />
<field name="document_raw_data" id="document_raw_data_applicant_2" />
<field name="category" />
</tree>
</field>
</group>
I do not know if this is what you were looking for, I hope it helps you.

Solr: how to query particuler entity when multiple

I am starting to learn Solr (using version 5.5.0). I am using managed-schema and data-congif.xml files to inex two sql server tables: Company & Contact.
I am able to execute from the UI, the data import, selecting one entity at a time.
This is the message I get for Company:
Indexing completed. Added/Updated: 8,293 documents. Deleted 0 documents. (Duration: 01s)
Requests: 1 (1/s), Fetched: 8,293 (8,293/s), Skipped: 0, Processed: 8,293 (8,293/s) Started: less than a minute ago
This is the message I get for Contact:
Indexing completed. Added/Updated: 81 documents. Deleted 0 documents.
Requests: 1, Fetched: 81, Skipped: 0, Processed: 81
Started: less than a minute ago
When I click the Query section, I want to perform a query to see all the Contact, and/ or Company records, not necessarily combined, but just be able to query them.
I am not sure how to do this, is it possible to get some help to understand how to specify against which entity I want to execute the query?
Here are the 2 files I modified:
data-cofig.xml:
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://sql.server.com\test;databaseName=test"
user="testusr"
password="testpwd"/>
<document>
<entity name="Company" pk="CompanyID" query="SELECT * FROM tblCompany">
<field column="CompanyID" name="company_companyid"/>
<field column="Name" name="company_name"/>
<field column="Website" name="company_website"/>
<field column="Description" name="company_description"/>
<field column="NumberOfEmployees" name="company_numberofemployees"/>
<field column="AnnualRevenue" name="company_annualrevenue"/>
<field column="YearFounded" name="company_yearfounded"/>
</entity>
<entity name="Contact" pk="ContactID" query="SELECT * FROM tblContact">
<field column="ContactID" name="contact_contactid"/>
<field column="FirstName" name="contact_firstname"/>
<field column="MiddleInitial" name="contact_middleinitial"/>
<field column="LastName" name="contact_lastname"/>
<field column="Email" name="contact_email"/>
<field column="Description" name="contact_description"/>
</entity>
</document>
</dataConfig>
managed-schema:
<!-- Company Begin -->
<field name="company_companyid" type="string" indexed="true"/>
<field name="company_name" type="string" indexed="true"/>
<field name="company_website" type="string" indexed="true"/>
<field name="company_description" type="string" indexed="true"/>
<field name="company_numberofemployees" type="string" indexed="true"/>
<field name="company_annualrevenue" type="string" indexed="true"/>
<field name="company_yearfounded" type="string" indexed="true"/>
<!-- Company End -->
<!-- Contact Begin -->
<field name="contact_contactid" type="string" indexed="true" />
<field name="contact_firstname" type="string" indexed="true"/>
<field name="contact_middleinitial" type="string" indexed="true"/>
<field name="contact_lastname" type="string" indexed="true"/>
<field name="contact_email" type="string" indexed="true"/>
<!-- Contact End -->
UPDATE
I tried using the fl field to select company_companyid, but I did not get any results.
I am including a screen shot:
To get fields as needed from a document, use fl. For example, if you were using SolrJ, you would have something like query.set("fl", "fieldA, fieldB").
In a URL, it looks like this: http://host:port/solr/coreName/select?q=*%3A*&fl=fieldA,fieldB&wt=json&indent=true

How to trigger checkboxes with XFDF

Here is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="text1">
<value>First Last</value>
<field name="checkbox1">
<value>yes</value>
</field>
<field name="checkbox2">
<value></value>
</field>
<ids original="xxxxx" modified="1331062234" />
<f href="http://example.com/test.pdf" />
</xfdf>
The text value gets entered in the PDF, but I can't figure out how to get the checkboxes to recognize that they are checked.
<input type="checkbox" name="checkbox_name" value="yes" />
The xfdf value entry needs to match the checkbox value:
<field name="checkbox_name">
<value>yes</value>
</field>

Indexing PDF documents in Solr with no UniqueKey

I want to index PDF (and other rich) documents. I am using the DataImportHandler.
Here is how my schema.xml looks:
.........
.........
<field name="title" type="text" indexed="true" stored="true" multiValued="false"/>
<field name="description" type="text" indexed="true" stored="true" multiValued="false"/>
<field name="date_published" type="string" indexed="false" stored="true" multiValued="false"/>
<field name="link" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
<dynamicField name="attr_*" type="textgen" indexed="true" stored="true" multiValued="false"/>
........
........
<uniqueKey>link</uniqueKey>
As you can see I have set link as the unique key so that when the indexing happens documents are not duplicated again. Now I have the file paths stored in a database and I have set the DataImportHandler to get a list of all the file paths and index each document. To test it I used the tutorial.pdf file that comes with example docs in Solr. The problem is of course this pdf document won't have a field 'link'. I am thinking of way how I can manually set the file path as link when indexing these documents. I tried the data-config settings as below,
<entity name="fileItems" rootEntity="false" dataSource="dbSource" query="select path from file_paths">
<entity name="tika-test" processor="TikaEntityProcessor" url="${fileItems.path}" dataSource="fileSource">
<field column="title" name="title" meta="true"/>
<field column="Creation-Date" name="date_published" meta="true"/>
<entity name="filePath" dataSource="dbSource" query="SELECT path FROM file_paths as link where path = '${fileItems.path}'">
<field column="link" name="link"/>
</entity>
</entity>
</entity>
where I create a sub-entity which queries for the path name and makes it return the results in a column titled 'link'. But I still see this error:
WARNING: Error creating document : SolrInputDocument[{date_published=date_published(1.0)={2011-06-23T12:47:45Z}, title=title(1.0)={Solr tutorial}}]
org.apache.solr.common.SolrException: Document is missing mandatory uniqueKey field: link
Is there anyway for me to create a field called link for the pdf documents?
This was already asked here before but the solution provided uses ExtractRequestHandler but I want to use it through the DataImportHandler.
Try this:
<entity name="fileItems" rootEntity="false" dataSource="dbSource" query="select path from file_paths">
<field column="path" name="link"/>
<entity name="tika-test" processor="TikaEntityProcessor" url="${fileItems.path}" dataSource="fileSource">
<field column="title" name="title" meta="true"/>
<field column="Creation-Date" name="date_published" meta="true"/>
</entity>
</entity>