I want to copy feature from stackexchange sites: every time you have list of questions, on the right side there is a list of all tags presented in them, including their count (frequency).
Is there any performance friendly way, how to obtain this kind of information without iteration through every element in view? Let's suppose it should work with common view data source, and content of the view can be altered by filter (keys, category) or fulltext.
I have already have considered (and refused) few solutions:
Iterate through collection - unusable for performance reasons (especially if ViewNavigator can't be used - FT query).
Counting tags in rendered content - limited to visible page only, tags for other pages are not counted (stackexchange counts tags for every page). Good performance though.
DocumentCollection.intersect - iteration through all tags and intersecting collections of all documents with that tag against source collection would result in count of documents with such tag. This approach is performance killer.
You could use a categorized view with a summary column and query it in json. Needs to be collapsed. ?ReadViewEntries&Outputformat=json
I would consider two basic approaches:
Store the tags in a multi-value summary text field in your question documents, create a categorized view based on that field, open the view, create a NotesViewNavigator, use CreateViewNavFromCategory to create a NotesViewNavigator that only contains the documents that match the tag, and get the NotesViewNavigator.count() property value.
Store the tags in a field (it can be multi-valued or single-valued, summary or non-summary text or even a rich text field) in your question documents, full text index the database, and use the Database.FTSearch method with a search formula that uses the FIELD keyword to get a NotesDocumentCollection, and use the NotesDocumentCollection.count() property.
For filtering, I think the latter approach may be better. You might be able to just revise your FT query to include additional conditions to accomplish the filtering. This could be very flexible, and should be pretty fast. With NotesViewNavigator, on the other hand, you would have to iterate through the NotesViewEntry objects in order to do the filtering.
Related
Folks:
I have recently begun working with xPages. I have a view of documents that needs to present data from other related documents in six separated columns. What I am trying is to use a Computed column that does a lookup to a view with a concatenated string. My intention was to parse this into the 6 columns of data. It isn't working and it may be silly of me to try referring to a computed column in another computed column.
Another alternative was to have the underlying view present the UNID of the other document and then do a #GetDocField on the xPages view.
So I have two questions:
1) May I programmatically refer to a Computed column in a view from another Computed column?
2) For efficiency, what would be the best way to present data like a 'join' in a view?
I appreciate your attention and help.
Cheers,
John Collis
Can you try to “go native” ? You build one view that contains both documents arranged to be in that view after each other. So you have Type1,Type2,Type1,Type2 etc.
Then use a repeat control to render a table or list “joining” the two rows.
This would save you doing tons of lookups.
Eventually you use that view as Json Rest source to do the joining in Json
I would create a Java bean that returns a list of Java objects that contain your data.
I am trying to create a categorized view of all Notes documents that have a field with exact same value, i.e. there is a field for Contractor Name and I want to create a view that lists each Contractor and the documents that relevant to each. How do I do this? I have tried view formulas like the following but no success as yet
SELECT #IsAvailable(Contractorid) & #Count(Contractorid) > 1
SELECT #Count(#IsAvailable(Contractorid)) >1
Nsf databases are no relational databases. The count of different documents with a unique value in a specific field cannot be used to build a view selection formula.
You could write an agent, that runs through all documents and counts them and puts all with count > 1 in a folder, but this is quite a lot of LotusScript code and needs some advanced knowledge.
The other possibilit would be to categorize the view by ContractorId and add one column before that categorized column: simply use 1 as column formula and select "display totals" in the column properties as well as "hide details".
Then at least you have the information, how much documents are in each category, but unfortunately you cannot filter by it and you cannot sort by this column.
A third possibility would be to use an xpage interface, but that is even more work to do and a completely different story developmentwise.
This is similar to view to identify duplicates. My approach is to use folder.
Make a new folder with design of your view. Instead of (not working) selection formula use short LS code as an action, or QueryOpen event (make sure only one user runs the script).
The code should cooperate with another (hidden) view sorted by Contractorid. Make a ViewNavigator for that view and traverse through it with simple logic - if previous entry has the same Contractorid as the current one, put both documents into folder**. That way you will get list of all documents with duplicate Contractorid. Make sure to wipe all the current content from the folder at the start.
** This can be optimized further by slightly more complicated algorithm to handle first duplicate diferently - for more than two duplicates this algorithm makes extra calls of PutInFolder method.
I am a bit confused about terminology. In SharePoint we have a List and it consists of List columns but I have read in one of the site that this can be meta data too.
Taking an example if we have a SharePoint list and if we have a List Columns with name, Job description, age and Income, will this be termed as column, field or metadata?
If this is metadata then how can you define fields/columns/site column?
You may know that Meta Data is nothing but data about data.
In share point context Meta Data can be used as list column also. Consider any excel documents which are classified using Phase , Category, Document Type etc. So when ever you see these columns you can identify what kind of document it is.
As per my knowledge key words are nothing but taxonomy. By using these keywords you can classify the items.
Site Column is different. Site Column can be used as list column in any list. For eg. Consider the Age. In your site you are using Age column repeatedly in your lists/libraries. So instead of creating Age column in each list you can create only one site column and you can add to required list. In simple words reusable purpose.
Fields are nothing but a columns/site columns. These are related to list.
As Mihir states, the word "metadata" means "data about data". So to have metadata you need to have data. In SharePoint the most relevant example would be documents. Documents are data and you can have data (metadata) about these documents. Mihirs Excel example is an example of this.
Say, you want a document library in SharePoint and these documents have a document type chosen from a list of choices.
To achieve this you need to be able to put a document type on the documents. Since Document libraries in SharePoint is a special kind of list, you can create columns=fields on the list - and the data in these columns becomes metadata for your document.
So on the library you create a field, DocumentType, e.g. as a choice field. The field is setup with possible choices for the document type. So the list fields/columns are used to define metadata on the document(s).
When it comes to pure SP lists it becomes more difficult to talk about metadata. For what is it data about? In case of an employee I don't think you can define it as metadata, expect if you treat the physical person as "the data". However, I don't think it technical make a difference. You have your datamodel of the employees and implement it using SP lists - that's what they are there for!
I have a document library where i have columns called Title and Category(is a lookup field) and User.Also,I have a list where i am just storing categories. I would like to join both document library and list so that i can dispaly all categories and the documents associated with it. once i get everything i would like to perform filtering so that it dispalys only selected user's documents.The displaying of the documents is working fine but not filtering. My questions is CAn we perform join between doc library and list? Plesae help me.
Thanks
The content query web part (CQWP)is probably the easiest way to do this without code. Since you only have one field in your lookup (categories) you don't need to do a join as SharePoint stores the lookup value in the Document Library. You will need to edit your CQWP to add this field, there is a good tutorial on doing this here. It also explains how to filter your CQWP.
Finally you will need to clean up your lookup field as SharePoint will store the value like this: 1;#Category1.
The CQWP uses XSLT to display the results so in your case you probably don't want to show 1;#Category1 you probably only want to show Category1. You can use the following XSLT to accomplish this:
<xsl:value-of select="substring-after(#Name_Of_Your_Lookup,'#')"></xsl:value-of>
There is an HTML form through which a user creates an item. Items are searched using usual sql query. Now a tag field will be supplied for each item on the HTML form. So while creating an item the user will enter a tag name for the item and the item will be created along with the tag name. User will then use this tag name to search for items.
What could be the best way to implement this? Is adding a tag column to every Item table a good way of doing it? What are the other possible options?
I believe you would want to minimize round trips to a database server. Tags would likely be an attribute of one of the items of interest and it is a many to many relationship. This is a well trodden path and you can find more information here.
If you want to be able to add multiple tags, then the best way would be to implement a table like this:
item_tag
item_id - Integer
tag_name - Varchar
or two tables:
item_tag
item_id
tag_id
tags
id
name
Use the post_tag table to contain a list of which tags are associated with which item. If you want to search for items by tag, then you could do a
SELECT * FROM `items` LEFT JOIN `item_tag` ON `items`.`id` = `item_tag`.`item_id` WHERE `tag_name` = 'value'
Here is a post discussing the best way to implement a tagging system, which suggests using three tables; e.g., items, tags, items_tags