function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Grouping and Subtotals in a PageBlock

Hello all,

I have a VF Page with a PageBlock Table and want to add a grouping and a Subtotal. 
Can one direct me into the right direction? Here is the Apex Code:
public with sharing class QuoteOLIs {

    public ApexPages.StandardSetController OrderLineItems{
            if(OrderLineItems == null) {
                OrderLineItems = new
                [select ID, Name, booking__c, PriceUnit__c, Sort__c, eTKP__c, Zuschlag__c, 
                 AgencyDiscount__c, No_AE__c, AgencyCommission__c, Position__c, Quantity__c, 
       , Volumediscount__c, ready_for_invoicing__c, 
                 SpecialDiscount__c, CustomerDiscount__c, DFP_relevant__c, DFP_gebucht__c, 
                 AD_Country__c, AD_Keywords__c, AD_Weekday__c, AD_Daytime__c, FC_Text__c, 
                 FC_Qty_Views__c, FC_TimeUnit__c,  FC_TimeUnit_Interval__c,Units_guarantee__c, 
                 Placement_Confirmed__c, Garantie__c, Media_gross_MB0__c, expected_Volume__c, 
                 AdItemName__c, Print_Issue__r.Name, Print_Issue__c, Campaign_Start__c, 
                 Campaign_End__c, Distribution__c, Listprice_single_man__c, Calc__c, Ext__c, 
                 override_Agencynet__c, manual_Agencynet__c, Agencynet_MN2__c 
               from CNQ_Order_Line_Item__c
               where booking__c = :ApexPages.currentPage().getParameters().get('id')
               ORDER BY Position__c,Sort__c ASC]));
            return OrderLineItems;
                  private set;
    public QuoteOLIs(ApexPages.StandardSetController controller) {
    public list<CNQ_Order_Line_Item__c> getOLIs()   {
        return (List<CNQ_Order_Line_Item__c>)OrderLineItems.getRecords();
     public Pagereference save(){;
        CNQ_Order__c quoteorder = [select id from CNQ_Order__c where id = :ApexPages.currentPage().getParameters().get('id')];
        return new apexpages.standardcontroller(quoteorder).view();


Thanks for any advice.
Add: I want to Goup by 'Position__c'