Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article provides a step-by-step guide to configuring the JSON Table macro in Confluence to augment data row values.

...

  1. Navigate to the app Global configuration page and configure the profile.

    2024-11-12_15-09-22.png

  2. Insert and configure the JSON table macro, as illustrated below.
    a. Select the configured Profile.

    2024-11-12_15-11-15.png

    b. Configure the Path to fields and Augment field section as given below:

    Code Block
    Paths to fields: $
    Paths to fields to be included: $.key, $.name, $.lead.active, $.projectTypeKey
    Augments to data row values: ,,,!Advanced Tables - JSON table macro augmentation^%lead.active%.png!,
    Augments to heading row values: ,,Status,Image 
    
    Columns to display: key,name,lead.active,Image,projectTypeKey


    The Augments to data row values have a new column parameter!Advanced Tables - JSON table macro augmentation^%lead.active%.png!. This is a replacement parameter that will replace the value of lead.active from true/false to image formats. This value will not alter the original column: $lead.active, but adds a new column where the lead.active values are represented as images instead of text.

    To render the data in image formats, attach two images with the exact naming convention of the lead.active values. For example, on the page Advanced Tables—JSON table macro augmentation, attach true.png and false.png files. Images attached for reference:

    false.png true.png

    2024-11-12_15-37-38.png

    2024-11-12_15-11-51.png

    2024-11-12_15-12-04.png

  3. To display the active projects at the top, apply the settings as shown below:

    2024-11-12_15-26-42.png


    Here is the Storage format for quick reference:

    Code Block
    <p><br /></p>
    <p>Get the Jira Project details from <a href="<BASE_URL>/rest/api/2/project?expand=lead"><BASE_URL>/rest/api/2/project?expand=lead</a> and display them in JSON table macro. </p>
    <p>Use the augmentation to replace the text on a certain column. For example, the lead.active returns true/false( representing the project status: Active / Inactive). To help users understand, one can replace/duplicate the original column to show the desired text in the image format as shown below.</p>
    <p><br /></p><ac:structured-macro ac:name="json-table" ac:schema-version="1" ac:macro-id="85e18df5-d88b-41d8-a077-c767ac960693"><ac:parameter ac:name="output">wiki</ac:parameter><ac:parameter ac:name="sortDescending">true</ac:parameter><ac:parameter ac:name="fieldPaths">$.key, $.name, $.lead.active, $.projectTypeKey</ac:parameter><ac:parameter ac:name="sortColumn">Status</ac:parameter><ac:parameter ac:name="columns">key,name,lead.active,Image,projectTypeKey</ac:parameter><ac:parameter ac:name="paths">$</ac:parameter><ac:parameter ac:name="profile">Jira Max</ac:parameter><ac:parameter ac:name="headingAugments">,,Status,Image</ac:parameter><ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:parameter ac:name="augments">,,,!Advanced Tables - JSON table macro augmentation^%lead.active%.png!,</ac:parameter></ac:structured-macro>
    <p><br /></p>
    <p><br /></p>
    <div class="table-wrap"><br /></div><ac:structured-macro ac:name="json-table" ac:schema-version="1" ac:macro-id="6783c445-589e-43ad-b57f-a01560c6f51b"><ac:parameter ac:name="output">wiki</ac:parameter><ac:parameter ac:name="sortDescending">true</ac:parameter><ac:parameter ac:name="fieldPaths">$.key, $.name, $.lead.active, $.projectTypeKey</ac:parameter><ac:parameter ac:name="sortColumn">Status</ac:parameter><ac:parameter ac:name="columns">key,name,lead.active,Image,projectTypeKey</ac:parameter><ac:parameter ac:name="paths">$</ac:parameter><ac:parameter ac:name="profile">Jira Max</ac:parameter><ac:parameter ac:name="headingAugments">,,Status,Image</ac:parameter><ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:parameter ac:name="augments">,,,!Advanced Tables - JSON table macro augmentation^%lead.active%.png!,</ac:parameter></ac:structured-macro>
    <div class="table-wrap"><br /></div>
    <p><br /></p>

  4. Save the macro and update the page to view the result. As you see, the project status (active/inactive) is now displayed as image icons.

    2024-11-12_15-28-14.png