Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is there a macro for data tables where we can provide columns and data and it creates table on page?

Ahmad Raza January 23, 2020

I have a requirement to programmatically add a table similar to html tables on a confluence page. I know I can add an html table in the html macro but i don't want that. Is there another option besides that?

1 answer

1 accepted

0 votes
Answer accepted
Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 23, 2020

Hi Ahmad,

I'm not quite sure I understand your question correctly. Do you have data somewhere (e.g. in a Database or accessible via REST) and want to display it in a Confluence page as a table? Or do you want just a static table? Maybe you could give an example of what you mean. :)

Also: are you on Server or Cloud?

Cheers,
Sven

Ahmad Raza January 29, 2020

Hi Sven,

I have an application which creates and updates pages on a space in confluence. So, I have data on my application server. I want to create a table on confluence using that data and using REST calls of confluence. For example, is there any option or endpoint where I can pass in the data and column names and page Id and confluence creates and populates the table automatically for me on that page.

Thanks.

Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 29, 2020

Hmmm... I'm not 100% percent sure I fully understand what you want to do yet, but it does sound like our app PocketQuery could be the solution to your problem. (You didn't say whether you're on Server or Cloud - if you're on Cloud you can pretty much stop reading here, because it's not available there yet)

With PocketQuery you could define a REST Query that fetches data from your external server. You can then insert the PocketQuery macro into page which will execute and render your REST Query into a table.

The only thing is that depending on the layout of your data, you might need to write a PocketQuery Converter or a PocketQuery Template. But I can help you with that, if you want to do that. :)

Let me know if this actually sounds like a solution to your problem of if you want to do something else!

Cheers,
Sven

Ahmad Raza January 29, 2020

Let me explain with help of an example. For example, I have data like this in my application server e.g. column names: name,id,date and I have arrays or lists of values for these three columns. Now I want to create a data table on a confluence page programmatically using this data. So, is there a macro available for this where I can pass this data as parameters to macro. 

I looked here for all the macros available: https://confluence.atlassian.com/display/CONF55/Working+with+Macros. But I didn't find one for simple data table or html table.

PocketQuery does sound like a possible solution, but if there is a macro other than that, it will be really helpful.

And yes, I am on server not on cloud.

Thanks.

Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 30, 2020

Hi @Ahmad Raza,

sounds really like PocketQuery would exactly do what you need. There definitely isn't a standard Confluence macro that does anything like that. You will need some kind of Marketplace App or code a User Macro or Custom Plugin yourself. 

Bonus: You can also use PocketQuery to connect to JDBC databases and display SQL results in your Confluence, using a macro. Maybe that's even a better approach in your case (depending on whether you have access to the database).

Cheers,
Sven

Like Dominic Lagger likes this
Ahmad Raza January 30, 2020

Alright, Thank you for your help Sven.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events