C1Olap WinForms subtotal column

Posted by: info on 13 February 2018, 7:02 am EST

    • Post Options:
    • Link

    Posted 13 February 2018, 7:02 am EST

    I am evaluating C1Olap for WinForms. How can in OlapFlexGrid CellChanged event reference a SubTotal column, in order to dynamically change the cell backcolor based on cell content/value?

    Is it possible to achieve this programmatically?

    There is another way than CellChanged event?

    Thanks!

  • Posted 14 February 2018, 7:52 am EST

    Hi,

    Thank you for showing interest in using our controls.

    Before, I proceed with helping you meet your requirement. I would like to inform you that we have another control named FlexPivot, which is an enhanced version of C1Olap and includes more advanced feature. Therefore, I suggest you to once review that control too.

    Here is the documentation link for the same: http://help.grapecity.com/componentone/NetHelp/c1flexpivot/webframe.html#FlexPivotOverview.html

    I would also suggest you to refer following link:

    https://www.grapecity.com/en/forums/winforms-edition/olap-vs--flexpivot

    Regarding your requirement of customizing the appearance of cells conditionally, we suggest you to rather use OwnerDrawCell event, which fires before a grid cell is drawn.

    I have attached a demo application to show its implementation and also attached an image showing the output observed using it.

    *The suggested approach works for the new control FlexPivot too. Let me know, if you need a sample in FlexPivot too.

    Regards,

    Ruchir Agarwal

    ConditionalFormatting_C1Olap.zip

  • Posted 14 February 2018, 1:49 pm EST

    Hi Ruchir,

    Thank you very much, this is a great solution.

    For me it would be easier to identify the column with its name instead of its index.

    I tried c1OlapPage1.OlapGrid.Cols[44].Caption); and I get the caption, while with

    c1OlapPage1.OlapGrid.Cols[44].Name); I get a string “Freight:0;{total}”, not a single column name (or field name). it’s a strange thing, in my opinion.

    Kind Regards,

    Silvano Rinaudo

  • Posted 15 February 2018, 1:53 am EST

    Hi Silvano,

    The Name of the aggregate column you are observing makes sense because ‘Freight’ column(the one having index:44) is actually a sub-column of ‘Total’ column hence ‘Freight:0;{total}’ is returned for Name of the column. Also, ‘Freight’ column exists for all the countries too and since we need a unique name for every column, we follow this naming convention for the subset columns

    To workaround this, you could use something like following:```

    if (c1OlapPage1.OlapGrid.Cols[e.Col].Caption==“Total” && Convert.ToString(c1OlapPage1.OlapGrid[1,e.Col])==yourColName&& e.Row >1)

    {

    // same code for customizing this column’s UI

    }

    
    Thanks,
    Ruchir Agarwal
  • Posted 16 February 2018, 9:36 am EST

    Hi Ruchir,

    now it’s all clear, thanks again.

    Silvano Rinaudo

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels