Kendo SearchBar - Order by StartsWith then Contains - kendo-ui

Say I have 3 jobs
1.Scientist
2.Data Scientist
3.Developer Scientist
Then in kendo searchbar while searching for the term "Scientist"
The result should be in the order like below
1.Scientist
2.Data Scientist
3.Developer Scientist
But Iam getting the result as below, which is wrong
1.Data Scientist
2.Developer Scientist
3.Scientist
Thanks for the answer in advance

The search bar provides only a filtering mechanism. The sorting functionality of the grid is separate and you should set it accordingly. However, if you would like to still have the sorted items you should implement your own sorting mechanism.
If you sort the items in descending order, you will receive them as "1. Scientist 2. Developer Scientist 3. Data Scientist". This is because the second letter of the Data scientist is "a" and comes before "e", hence, in descending order "Developer" will be shown before "Data".
If the custom sorting sounds like a plausible option to you, use the following option of the grid:
Custom sort function declaration
Please note that this would work only if you are using client-side operations.

Related

How to rank values from asc/descending?

Struggling to find rank values from highest to lowest, please see attached example of what I'm trying to achieve.
My current custom expression is:
Sum([ViolationAmt])
I have tried this:
Sum([ViolationAmt]) over Rank([ViolationAmt])
I've played around with the rank expressions however unable to implement...would be very grateful for some help.
Spotfire Rank Example
I need to make a lot of assumptions here because I don't know anything about your data set or really what your end goal is, so please comment back and/or provide more info in your question if I am off base.
the first assumption is that each row in your dataset represents one, for simplicity, [AccountID] with a [ViolationAmt]. I'm also guessing you want to show the top N accounts with the highest violations in a table, since that's what you've shown here.
so it sounds like you are going to need two calculated columns: one for getting the total [ViolationAmt] per account, and then another to rank them.
for the first, create a column called [TotalViolationAmt] or somesuch and use:
Sum([ViolationAmt]) OVER ([AccountID])
for the second:
Rank([TotalViolationAmt])
it will be useful to read the documentation on ranking functions if you haven't already.
you could probably combine these two into a single column with something like:
Rank(Sum([ViolationAmt]) OVER ([AccountID]))
but I haven't tested this at all. again, if you put in a bit more detail about what you're trying to accomplish it will help you get a better, more detailed answer :)

Custom sort order

I need to sort data in LibreOffice Calc using a user-defined sorting function (Small, Medium, Large, X-Large). The sort menu offers a "custom sort" option, but the sorts are all pre-defined and I do not see how to add a new one.
Disclaimer: I am completing an assignment intended for users of Microsoft Excel, but I prefer to use LibreOffice over booting up Windows.
I also need to sort cells that are formatted in a certain way, specifically cells with a red fill need to be sorted at the top of the list.
The "custom sort" lists are defined in the Options dialog.
You can add additional sort lists manually. Go to Tools->Options->LibreOffice Calc->Sort Lists and add a new list.
Sorting based on formatting is not yet supported in LibreOffice. There have been plans to add this functionality but nobody has worked on implementing the feature yet.

I need to change the sorting mode numbers in drupal 7

I am having a problem with drupal 7. We have a content type named "resolutions", which represents sorted numbers: 1-10-2-20, etc. I would like to know how to add "0" to the numbers from "1 to 9" so they look like "01-02-etc". I tried to sort number module, but this doesn't work. If anyone could give me a solution, I would be grateful.
If you are using Views to list your nodes, which I suspect you are, you should try the Views Natural Sort module.

Visual Basic - Website Form Calculation

I am studying my first year in Programming and I have a slight problem in relation to Visual Basic coding. I know this sounds slightly vague, however I just wish to find out whether i need to create a variable, array or function.
I am creating a website app which processes a mobile phone order. I have designed a form which includes the quantity of mobile phones a particular customer requires, and the type of mobile phone the customer wishes to order.
I have included quantity values from 1-5 and 5 different types of mobile phones. I also have a button 'Process Order'. I just want to know how i can assign a particular type of mobile to the quantity.
In other words a calculation function where if I click process order, a price will be displayed showing exactly how much it costs for the phone + quantity needed. I have included a combo box with the list of phone types and the prices of each phone.
I want to be able to create a code which links a phone to a quantity for example Qty: 2 Type: superphone (costing £45). Once i process the order I should see a total price of £90. I am not expecting anyone to do it for me, just a simple explanation of what i need to look at in order to figure out the coding :)
It sounds like you are searching for the Dictionary class.
A dictionary matches some input (called key) to an output (called value). In principle, the same can be achieved through a function but a dictionary is more concise, can be changed at runtime, and may also be more efficient.
Conceptually, an array is just a specific type of dictionary that maps the input values 0 – n (its indices) to the indexed values.
Example:
Dim phonePrices As New Dictionary(Of String, Decimal)()
phonePrices.Add("Nookia", 12.30)
phonePrices.Add("Motolola", 12.12)
phonePrices.Add("THC", 42.00)
These prices can then be looked up by using the indexer:
Dim priceOfMyNookia = phonePrices("Nookia")

How to Build a User Friendly Filter

Our application displays tons of valuable information to our users in a table. We have a filtering capablity that is based on boolean/logic searches. Even after coaching, users still tend to not understand how to use filters because AND OR > >= etc are foreign to them. This filter is easy for programmers since it is easily translated into code. Any examples on how this can be made more user-friendly and less prone to error?
In the past, when I needed to solve this problem, I presented the users with a list of items (in one or more columns), and gave them a single text box to type text into. I would then match the text against the text in the columns, and collapse the list (removing records that do not match) as they type.
This approach reminds users of Google. Everyone knows how to Google.
If you don't like the idea of presenting a large list of all items initially, you can show an empty results pane first, and display results after a search is typed in.
Convert operators to plain English text and ask them to select from it.
For eg: To
Show me all Books whose author is [text field] and the price is [less than/greater than] [text field]
[less than/greater than] is a dropdown list
[text field] is an input box
The resulting text after the user has filled in all the fields should result in plain simple English
Eg: Show me all books whose author is Stephen King and the price is less than 10 $
I used this in an app of mine when I used to freelance and the users loved it.
Using some nifty UI programming you can give options to expand the filter to n levels.
In web applications, telerik had a good idea with their grid, you should be able to do that in desktop applications too.
you can provide some preset filters for the most common queries to that table - if that's possible with the application you are using
you can provide a "count instead of display" mechanism so the user sees how many rows he/she will potentially retrieve
you can provide them a Wiki page with some examples online
you can give them a QBE tool
hope that helps
good luck MikeD
In my experience you are simply not going to get end users to understand the difference between AND and OR conditions. Therefore I build my filters so that ANDing or ORing is built in. In general, my logic is as follows:
Criteria for different fields are ANDed together to restrict results.
Multiple values for the same field are effectively ORed together and then ANDed onto the criteria for other fields. I generally detect input into a single field of comma-separated lists (translated to IN ()), dash-separated ranges (translated to BETWEEN), wildcard values (translated to LIKE), and any combination (for example Customer ID: 1-10, 50, 52).
I find that most users intuitively understand this system.
Of course, from time to time a different interface with some degree of ORing is required and in those cases I generally have a section of the search user interface in a panel or group box labelled "Any of these is true".
I have recently been working on this problem. My solution is to be more descriptive, to use words instead of symbols and to change the words where it allows for a more readable layout. To illustrate, imagine the filter expression:
Breed == "Spaniel" AND (Age == 2 OR Colour == "White")
Certain linear Query builders might write this:
( And/Or Field Operator Value
[ ] [Breed] [=] [Spaniel]
[1] [AND] [Age] [=] [2]
[1] [OR] [Colour] [=] [White]
Or a hierarchical one may display this as:
AND
[Breed] [Is Equal To] [Spaniel]
OR
[Age] [Is Equal To] [Spaniel]
[Colour] [Is Equal To] [White]
Both of which might be readable to a developer but not so readable to the layperson.
My solution is more like:
Show ALL records where
[Breed] [Is Equal To] [Spaniel]
Show ANY records where
[Age] [Is Equal To] [Spaniel]
[Colour] [Is Equal To] [White]
So borrowing from the hierarchical approach but changing the AND and OR to an ALL or ANY. This means it can be read from top to bottom a little more easily.
I think Django's built-in admin interface has a very intuitive UI for filters.
There's a simple screenshot in the docs but there's a lot more you can do, especially when filtering on dates.
You might want to take a closer look at Django's admin interface to see if you can apply some of their tricks to your case.
I would think something similar to MS Access Query generator. You may also want to have good context sensitive help system that will guide first time users.
Theresa Neil illustrated several approaches for building complex rule interfaces (AKA predicate clauses) in the iTunes Solves the Nested Clause Dillema post. Some good examples there. I really like the way Apple does it in iTunes (although, I don't use iTunes).

Resources