KQL - Ignoring items with property not equal to value - search

I have to configure the site search so that it does not include items wich have a property of ModerationStatus != 1. I found out that using a query like ModerationStatus <> 1 can probably solve my problem, but I am not sure if it will work in my environment since not all possible search items have this property of ModerationStatus. Can someone show me an example query that might work in such case? I am kinda new to KQL.

So I think I figured it out. I'd have to white two queries combined like this:
(ContentTypeId: 'ContentType that has ModerationStatus' ModerationStatus <> 1) OR (ContentTypeId <> 'ContentType that has ModerationStatus')
I apologize for the dumb question.

Related

Tabulator - exclusive header filters - how?

I wrote and support a little web app for our local animal shelter to help volunteers locate dogs. I chose Tabulator because it had great features and was easy to use and have been very happy with my choice. For the first version of the app I used external input fields to search and manually did all the wiring to support live search.
Now I am working on v2 and am trying to use header filters. My problem is that the filters need to be exclusive, that is, using filter1 clears/disables filters 2 and 3, using filter2 clears/disables 1 and 3, and so on. With the external search fields I used focus() events to do this. When I try using jQuery on(focus) delegates to do the same with header filters and for example table.setHeaderFilterValue("field1", "") it does not work; the event triggers but the input box never gets the focus so I cannot type in it. I've tried different events like click; but nothing I've tried works properly.
I've studied the docs and struggled with this for several hours. I've considered hooking dataFiltering() and eliminating the filters I don't want, but I'm not sure how to identify the filter that I want to keep, and there is still the matter of the text in the fields to be dealt with. I'm sure it doesn't help that front-end work is not my area of expertise, though so far I've managed well enough. Is there a simple or normal way to do this that I'm just not seeing?
For the record, I found a way to do exclusive filtering with header filters with a single event callback:
\$(document).on("focus", ".tabulator-col input[type=search]", function() {
var hfNames = ["name", "anum", "kennel"];
var fieldName = \$(this).closest(".tabulator-col")[0].getAttribute("tabulator-field");
hfNames.map(function(hfN) { if (hfN != fieldName) table.setHeaderFilterValue(hfN, "") });
});
The three hfNames are the field names of the columns with filtering on. Yes, I could have derived them dynamically, but it didn't seem worth it for a small app like this.
As I suspected, the key was simply a better knowledge of JQuery.

Xpages search view with exact matches

I am searching on an Xpage and the first column have these 4 values:
NAP
NAP/IFI
NVO
NVO Domestic
You probably see the problem. If a user searches for "NAP" they get both "NAP" and "NAP/IFI" as the = operator is really a CONTAINS! I didn't know that. In most universes = means exact match, not contains, but it is what it is.
The question is there any workaround for this?
You can set the Property searchExactMatch to the ViewPanel for ftsearches.

Programatic control using Telerik OpenAccess ORM and the RadGrid

Ok, between following documentation, posts and videos that use syntax and tools that are no longer used or available, I'm really lost as to how to go about even using Telerik's OpenAccess. So I thought I'd ask for some help and hopefully someone out there has done this before.
I want to simply bind my OpenAccess entities to a RadGrid, but I want to use TemplateColumn in my RadGrid (in editmode, I want to use other controls like datepickers, dropdowns, etc.) Therefore, like the old way of doing things, I want to fire off the RadGrid's ItemDataBound event, for example, find the controls and set the controls to the appropriate values.
Old way that we were used to (You know, like the old fashioned way of something like setting a RadTextBox to a value from the RadGrid's DataSource, which was a DataReader:):
string strID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["campaignID"].ToString();
RadTextBox rtxtTitle = (RadTextBox)e.Item.FindControl("rtxtTitle");
rtxtTitle.Text = DataBinder.Eval(e.Item.DataItem, "title").ToString();
Does anyone have sample out there of how to do this? I would assume that I would also need to know how to bind the RadGrid in the first place, so an example of that would also be helpful (NOT using the actual OpenAccessDataSource control - I want to bind it in the NeedDataSource event of the RadGrid).
Thanks in advance...
The sample I found on the Telerik web site for DataBinding an OpenAccess result to a DataGrid looks like this:
IObjectScope scope = ScopeFactory.GetScope(HttpContext.Current);
string query = String.Format("SELECT * FROM {0}Extent", viewName);
IQueryResult result = scope.GetOqlQuery(query).Execute();
RadGrid1.DataSource = result.ToList();
This looks to be using OQL, but you could also use LINQ. I would toss this question to the OpenAccess team on the forums. They can probably point you to better resources.

Why the OnWorkflowItemChanged is different between List and document library?

I am doing a workflow for a document library. I put a OnWorkflowItemChanged, and I want to get the value of the column which is changed. I use the workflowProperties.Item["name"] and use the afterProperties. But when I use the workflowProperties.Item["column name"], I still got the original value. When I use the afterProperties, it's NULL.
Then I make another workflow that is the same as above for a list. I can use the workflowProperties.Item["column name"] to get the new value in OnWorkflowItemChanged.
Has anyone come across this problem before? Can you give me some help?
The question seems to mix up Item with ExtendedProperties. As to why a difference is seen on a List/Document Lib, it might have something to do with versionining or perhaps the internal serialization is different. Anyway, some of my experience is outline below. I hope it may be of use:
Use the GUID (as a Guid object, not a string) to access the Before / After ExtendedProperties field. Using the Display Name in the ExtendedProperties will not work. The documentation on it is wrong. You can use SPList.Fields to go from Display Name to Column ID (Guid).
I bind all "Before" to MyWhatever_PreviousProperties and all "After" to MyWhatever_Properties, only accessing MyWhatever_[Previous]Properties after the appropriate event(s)).

Find a field on sharepoint site

Let's say I have a string array of field internal names. How do I get their display names?
I've been searching for an answer and found that there is a SPFieldCollection(SPWeb web, string strXml) constructor. My first thought - yeehaw, i can pass a CAMLquery and get SPFieldCollection objects to work with.
However for strXml I've tried passing following CAML query:
<FieldRef's> (<FieldRef Name='Abc'><FieldRef....)
<ViewFields><FieldRef's></ViewFields>
<Fields><FieldRef's></Fields>
but unlucky. No results.
Any ideas on how to do this?
Is there any reason in parcitular you don't want to loop through the names and call
web.Fields.GetField( internalName )
for each name?
One drawback from this approach is that GetField will fallback onto display name matching if the internal name can't be found, so if you have some funky crossovers between internal and displayname things might get a bit tricky. In that case I'd loop through the FieldCollection in stead and match the other way around, directly on InternalName.

Resources