0

Is there any way to sort fields in Calculation View, We can sort fields in Data Preview but it is limited to 200 or some number of rows but how to apply sorting logic in calculation view only.

vikas parmar
  • 11
  • 2
  • 3

2 Answers2

0

The preview limit of 200 is configurable in HANA studio and is related to the SQL query that is used to display the data.

Generally speaking, sorting is not fixed in calculation views. Remember that calculation views are only part of the equation - the SELECT query that reads the view is the other one. Therefore, sorting, grouping and the final filtering and projection are always specified in this SELECT statement.

In case you really need to provide a pre-defined sort order, then you can put your SELECT against the calculation view into a SQL view. That, of course, comes with the downside that SQL views are not exposed as information views, something reporting tools might rely on. Also, the sort order in the SQL view can easily be "overridden" by specifying a different sort order in the SELECT statement that queries it.

Lars Br.
  • 9,949
  • 2
  • 15
  • 29
0

As Lars wrote in his answer, tables and views are source of unsorted data actually. Data sorting is done in the SELECT statement which runs over the view or table. As a rule, trying to sort data using ORDER BY within the view definition should cause a syntax error or a warning message. And there is not a guarantee that data will be served in order defined in the ORDER BY clause used in View definition.

But what I experience with HANA DB views it works(!) but should not Here is an example view definition

create view my_city_list_view
as
select * from city order by city desc
;

And a simple SELECT returns ordered data which I cannot understand

select * from my_city_list_view;
Eralper
  • 6,461
  • 2
  • 21
  • 27