Replace count with confluence content in pivot-table

Issue #5 resolved
Douglas Swartz created an issue

Hi Xavier,

I was considering writing my own pivot table macro when I found yours in the Atlassian store. I'm trying it out and generally like the way it works. However, to meet my purposes, it needs an enhancement.

I need an additional calculation type. What I need is very similar to count, but I want to display an icon or other Confluence content instead of the count. Here;s what I can generate today with pivot table: SamplePivotTable.png

Here's what I would like to generate: DesiredPivotTable.png

Comments (13)

  1. Xavier Arques

    Doug

    Sorry for the delay in my answer. Your issue notification e-mail was in my span folder. Can you be more precise in your enhancement request ?

    1. Do you want to change any count value by an icon ?
    2. Or depending of the count value, do you want to display a different icon ?
    3. What kind of "other Confluence content" should be displayed ? Hyperlink ? Image ? , ...

    Thanks

  2. Xavier Arques

    Doug

    Any updates to my previous questions ?

    I want to propose a more generic solution based on user macro: The idea is to delegate calculation types to a user macro named "pivot-values-calculation" containing 2 parameters:

    • bodyTableValues : The list of values contained in a pivot cell before calculation
    • typeOfCalculation : A enum list containing the list of calculation types supported by the user macro implemention

    If this user macro exists on the Confluence server and contains the 2 above parameters, the enum values defined for parameter typeOfCalculation are automatically added to the "Type Of Calculation" field inside the Macro Editor.

    Then, if the typeOfCalculation is not count, sum or average, Pivot Table macro delegates the rendering of each Pivot cell to the user macro by passing it the list of values and the type of calculation.

    So you can define your own rendering. In your use case, it will be :

    <p>
      <ac:emoticon ac:name="tick"/>
    </p>
    

    What do you think ?

    Xavier

  3. Doug Swartz

    Xavier, I think the generalized approach you've outlined is great. I might suggest you let the user specify the name of the macro rather than hard coding it. That way if I have pivot tables on different pages with different rules, it will be possible to use different logic.

    Thanks for the direct note.I've been distracted with a bunch of other stuff recently.

    Doug

  4. Xavier Arques

    Doug,

    I just released Pivot Table 1.5.0

    For the moment, the user macro is hardcoded (pivot-values-rendering) but the enum values of parameter typeOfRendering are automatically added to the Type Of Calculation field in the macro browser of Pivot Table macro so as you requested it is possible to use different logic. This avoids overloading the macro browser with unnecessary parameters. I hope it works for you. See documentation.

    Please give me a feedback and I should be grateful if you would write a review and give a rating for my plugin

    Thanks

    Xavier

  5. Douglas Swartz reporter

    Xavier,

    The 1.5 functionality looks perfect. I'll be trying it out in a week, or so.

    Question: Do you intend to make pivot-table a "for cost" plugin in the future?

  6. Xavier Arques

    Doug,

    I am waiting for feedback within 1 week

    I don't intend to make pivot-table a "for cost" plugin for 2 reasons:

    • I work alone on it on my spare time and I can't provide enough support paid customers would expect.
    • I do it for fun

    Why did you ask this question ?

    Xavier

  7. Douglas Swartz reporter

    I ask the question because it's becoming a nice little plug-in. If we start to rely on it, I want to have an idea of whether we will have an expense for it in the future.

    Thanks.

  8. Douglas Swartz reporter

    The customizing macro works perfectly. See below.

    The only thing I can imagine is that a site might not want to expose every customized cell calculation to every user using the macro. Maybe it would make sense to enable an "other" selection in the enumeration, with a separate field where you could enter the name of the method. This would be easy to handle in pivot-values-rendering, but would require you to make the additional field available in the context.

    Doug Sample of Confluence Pivot Table.png

  9. Xavier Arques

    Doug

    Thanks for your feedback. Can you elaborate you proposal ? I don t understand what should appear in the additional field.

    Xavier

  10. Douglas Swartz reporter

    The additional field would simply be a text box.

    If I have a special cell calculation method that's not generally applicable, rather than adding it to the enumeration list in pivot-values-rendering, I would instruct the page developer to choose "Other", and enter the name of the calculation method in the text field. The value of the text box would need to be available to pivot-values-rendering.

    This doesn't clutter the drop down with calculation methods that only one page will ever use.

    As I'm writing this, I'm thinking: "Maybe the text field is simply called "Custom Calculation Argument". This could be useful in more than the case where I want to hide unique calculation methods. For instance, I might want to pass an argument to the "stars" method which tells it the maximum number of stars to display.

    Doug

  11. Douglas Swartz reporter

    I'm sorry Xavier. I meant to open a new issue and accidentally re-opned this one. :(

  12. Log in to comment