OpenEdgeDataProvider - Sorting

Is it possible to use the OE DataProvider to control sorting?

I have tried using the SetInitialSortBy method but it does not seem to work.

oProvider:SetInitialSortBy(“ePoLine”, “BY Descrpt”).

I just tried it with Sports customer sort by name and it works. (LL26)
Just must not have a sort for this table in the layout. The InitialSortBy is only used when there is nothing defined in the layout.

Maybe you have removed the table prefix “e” for your dataset service !?
Then you should use: oProvider:SetInitialSortBy(“PoLine”, “BY Descrpt”).
Check the return value:
lok = oProvider:SetInitialSortBy(“ePoLine”, “BY Descrpt”). lok=true means the table was found.
Also make sure that you call the method after oProvider:initialize().

1 Like

That was it…thanks.

Thomas,

If I am using oDatasetService:TablePrefixToRemove it appears I still need to include the Prefix when calling SetInitialSortBy.

In my example above my TT is ePoLine but I have ‘e’ set to the TablePrefixToRemove. In my Combit template I see PoLine not ePoLine. However, if I use ‘PoLine’ when calling SetInitialSortBy it does not work. I have to use ‘ePoLine’. Is that correct?

Hi Roger,
you are right. You have to use ePoLine. SetInitialSort expects an ABL Sort Expression and doesn’t care about TablePrefixToRemove. I cannot change this anymore because this would break existing implementations.

But - this method is only there because until LL23 it wasn’t possible to define a sortby for a report with master mode AsVariables. I don’t use it anymore and always sort through the layout. What’s the reason for you to sort through SetInitialSort() ?