Skip to Content

SAP Business One Grid Column Get Sorting Type

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Aug 08, 2017 at 05:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 08, 2017 at 06:47 AM

    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".

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 08, 2017 at 08:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded