cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Business One Grid Column Get Sorting Type

0 Kudos

Hi,

I need to get whether grid column is sorted ascending or descending.

I have tried get it from GridSortAfter .

private void Grid0_GridSortAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)

pVal value only shows the column id not sort type.

How can i get the sort type asc or desc?

Accepted Solutions (0)

Answers (3)

Answers (3)

pedro_magueija
Active Contributor
0 Kudos

Hi Gul,

Have a look here: https://archive.sap.com/discussions/message/10139064#10139064

One commonly used approach is to check the title for the ordering "symbol". That was the way long ago and since SAP still hasn't provided with a proper "sort direction" property I believe we are still stuck with it.

As for knowing which column, you can use the same approach since only one column can be ordered at any time (using the grid sorting).

Pedro Magueija

LinkedIn | Twitter | Blog

0 Kudos

Thanks Ankit,

But i dont want to order 2 columns.

I only need to know in which column is sorting and what is the sorttype of the column (ascending/ descending).

I can get the info about the valueof the column with GridSortAfter ( "pVal.ColUID" shows me "Banka Adı" column)

yet , by doing this i have no idea about the sortype of the mentioned column?(SAPbouiCOM.BoGridSortType)

How can i get column is sorted "descending".

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

As per my knowledge in previous versions, Ordering is done automatically when using grouping for grids. If you want to order 2 columns, you need to use 2 levels of grouping (oGrid.CollapseLevel = 2). This will automatically sort the 2 columns in ascending order. Also, the ordering of grids using the "ORDER BY" statement was a missing functionality in SAP Business One SDK.

Therefore, you can give it a try in latest available version and check whether it helps!

Kind regards,

ANKIT CHAUHAN

SAP SME Support