From The CA Plex Wiki
This needs some clearing up, but wanted to get it in here...
Create a function called Wrapper with the following triples.
Wrapper is a ServerShell Wrapper is a ServerExternal Wrapper input view Entity.Fetch ...for Position Wrapper input FLD Position ...for Control Wrapper dual FLD RowsFetched ...for Control Wrapper input FLD SortBy ...for Control Wrapper output view Entity.Fetch ...for FetchedData Wrapper variable FetchedData ...as Output ...occurs 64 Wrapper variable Position ...as Input Wrapper variable Control ...as Input
The field SortBy has values that correspond to the views that you wish to sort by. Create a subroutine in the function wrapper and call it from the Pre point Execute. In the subroutine determine which BlockFetch you really want to call in a Case statement and insert the relevent calls. Map Position and Control to the input variable to the wrapper function.
The reason that I mapped the entire Entity.Fetch view to the Position variable is because the Key sequence of the view could contain any fields from the Entity.
When you first call the wrapper function for each view that you want to use you will need to set the field Control<Position> to Yes. Remember to do this each time a new view is used.
After the call the the BlockFetch set Output = Output from BlockFetch and the Control<RowsFetched> to the values returned from the block fetch.
Replace the BlockFetch for your Grid function with the wrapper function.
If called from a grid then the RowsFetched parameter should me mapped to GridL<BufferedRows>