Sorting on a calculated field - sapui5

Is it possible to use a sorter over a calculated field? If so, how would it look like on an XML view?
I couldn't find anything on the docs or in the openui5 github repo.

Short version: No, it's not possible in a XMLView!
Long Version:
You can create a separate field on your model with the calculated value in advance and sort on that newly created field.
You can easily create and apply the sorter from the corresponding controller. A Sorter can implement it's own compare function like this: Sorting and Filtering in JSON Models

Related

Get Firebase Auto-ID column in FlutterFlow

Reviewing one of my Firebase schemas I can see that I have a couple of columns, but the auto-generated ID column does not show up:
However, when clicking on "Manage Content" the ID column can be seen:
The problem I have is that in other collections I make a reference to this collection by this ID, however, it doesn't pop-up in FlutterFlow to filter on:
Question: Is it possible to get the Auto-ID column in FlutterFlow?
As far as I know that is unfortunately not possible.
You could solve this by adding a column CopyOfId to your scheme.
You could then write a Firebase Function that triggers when you create a new document (https://firebase.google.com/docs/reference/functions/firebase-functions.firestore.documentbuilder.md?authuser=0#firestoredocumentbuilderoncreate). You could make this function copy the contents of the ID column to your own CopyOfId, making it accessible in FlutterFlow.
A deeper question is maybe for what use case you want this behaviour: why would you need to filter on an autogenerated ID that you do not know the value of - and that you can't access - in FlutterFlow? If we know your use case, there is probably another way to achieve what you want to achieve.

DOMINO REST API get Collection sort column

Hi I'm trying to get a sorted Collection from the Domino Rest Api. My database name is "Test/JSON_Views.nsf" and my views name "List".
The endpoint I use is
**/Test/JSON_Views.nsf/api/data/collections/name/List?sortcolumn=title&sortorder=ascending&count=20
But the JSON-Response entries aren't sorting by title in ascending order.
Should I make any settings to the column properties in the designer? If I set descending there for the title-column it works. But I want to change the sorting in my external java-application.
Is my endpoint correct? I use this Domino API Docu as Reference.
Add an additional sorting to your title column:
This gives the API the possibility to sort by title in both directions. You can do this with other columns too so you are very flexible in sorting this way.
The doc says that if the column isn't sorted in design then the sortcolumn parameter has no effect, so the answer is "Yes" you should change the design of the desired column. If doing that is unworkable in whatever context you use it, then create a second view and use that instead.

Table with sort using column Headers in UI5. Table sorter

I would like to provide table sorter i.e possibility to sort the table by clicking on a Column. For Example: Product Name column shows the possibility to sort. https://openui5.hana.ondemand.com/#/sample/sap.ui.table.sample.Sorting/preview
I want to do a similar thing in sap.m.table as I see sap.ui.table is not valid for phones according to https://openui5.hana.ondemand.com/#/api/sap.ui.table.Table/overview
Can I achieve this in some way? Or any insights on any alternative approach I can take?

SAPUI5 Filter Search

I'm Developing Fiori App with Master-Master-Detail template,
First I'm filtering by date but I want to use the search box that it's generated by default.
I need to use both condition filters: Date and the element specified in serach box.
Somebody knows how to add search filter without remove previous filter?
The filters are applied to the ListBinding and there is no official API to access to current filter objects. You could store the filters somewhere in your controller, but eventually, you'll need to call the filter method again with all the filters that you want to apply.

Finding the number of different values of an attribute

I am writing an APS.NET MVC 5 application in C#, using a MongoDB database. Suppose I have a MongoDatabase object called my_db, which contains a MongoCollection of Label objects, called labels. Each Label object has a few attributes, one of which is a string called tag. Each tag value may be shared across different Labels, such that some Label objects will have the same value for tag.
I want to find out how many different values for tag there are in this collection, and store these values in an array of some sort.
I'm fairly new to MongoDB, so I don't really know how to do this. All I have done so far is get labels:
var labels = my_db.GetCollection<Label>("labels");
But I'm stuck as to what I need to do now. I could manually iterate through each Label in labels, and check whether that Label's tag attribute has already been seen before. But is there a neater way to do this with a MongoDB function? Thanks!
There is a MongoDB method for this: distinct, that should exist in any API.
As you are doing this on MVC 5 c# application, MongoDB provides C# LINQ Driver which will help your querying MongoDB using LINQ.
http://docs.mongodb.org/ecosystem/tutorial/use-linq-queries-with-csharp-driver/
Hope this helps.
var query = (from e in labels.AsQueryable<labelClass>()
select e.tag).Distinct()