How to read queryArray by index

Populating a dataTable array I am using this code working properly:


var result = PocketQuery.queryArray();

  var dataTable = [['FIELD1', 'FIELD2']];

    jQuery.each(result, function(index, row) {




In order to reuse the same template for other queries, I intend to replace the line in bold by

dataTable.push([row[0], row.FIELD2]); ... but despite that there is no error, I obtain no value for FIELD1...


Any idea how to make "row[0]" working properly will be highly appreciated!!! wink


Thanks in advance



1 answer

1 accepted

This widget could not be displayed.

Hi Cuto,

Please try like this:

var columns = PocketQuery.queryColumns('yourQueryName');
var result = PocketQuery.queryArray('yourQueryName');
var firstColumnName = columns[0];
jQuery.each(result, function(index, row) {

Let me know if this helps!

Regards, Felix (Scandio)

Excellent! Thanks again Felix!!!!!

I let 'yourQueryName' empty and it works... what allows me to use my template in many queries!


Yes. It will work as long as you only have one PocketQuery macro on your page smile


I have many PocketQuery macros in the page... and it works!

In that case, queryArray() will return the result of the last macro that was run on the page. Note that queryColumns(...) requires a query name. You can also retrieve the query name of the current PocketQuery macro in the template.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

603 views 8 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you