pocketquery plain text output

Hi,

Is it possible to configure pocketquery to output data in plain text? I want to feed result of a query into scaffolding variable with replace-and-render macro like this:

{replace-and-render}
 {replace-body}{set-data:custname}%cn%{set-data}{replace-body}
 {replace-item:%cn%}{pocketquery:name=MSCRM_get_customer_name_by_id|parameters=crm_id=709F8D70-B8A2-DE11-95D6-0016359F287C}{replace-item}
{replace-and-render}

But I get following result:

 

pq.png

Instead of actual query result (marked green)

Or is it possible to do it other way?

Thanks!

3 answers

Hi Alexey,

Interesting use-case! I've never thought of that before, my assumption was always that the output would be something HTML-alike. There is no clean way to achieve what you want at the moment. But I wrote a possibility to produce plain text on the long-term roadmap of PocketQuery.

In the meantime, I can offer you a template workaround. You could use something like this in your PocketQuery template (I know this is not a particularly pretty solution):

$result.get(0).id ## just output your plaintext result here
<script>
(function() {
	var plainText, clone = jQuery('.pocketquery-result').clone();
	clone.children().remove();
	plainText = jQuery.trim(clone.text());
	jQuery('.pocketquery-view-container').before(plainText).remove();
}());
</script>

Let me know if this helps!

Regards, Felix [Scandio]

Hi Felix,

 

Thanks for trying to help.

Unfortunately, output with your template looks like this:

<div class="pocketquery-view-container"> <script> PocketQuery.chartJson("MSCRM_get_customer_name_by_id", "{"cols":[{"id":"customer","label":"customer","type":"string"}],"rows":[{"c":[{"v":"Rive Gauche"}]}]}"); PocketQuery.queryJson("MSCRM_get_customer_name_by_id", "[{"customer":"Rive Gauche"}]"); PocketQuery.queryColumns("MSCRM_get_customer_name_by_id", "["customer"]"); </script> <div class="pocketquery-result "> Rive Gauche<script>(function() { var plainText, clone = jQuery('.pocketquery-result').clone(); clone.children().remove(); plainText = jQuery.trim(clone.text()); jQuery('.pocketquery-view-container').before(plainText).remove();}());</script> </div> </div>

 

So it seems that I have to wait your "plain text output" feature.

No give up so fast ;). Is your desired output "Rive Gauche" as plain text?

Hi Alexey,

So, I implemented the "plain text feature" in version 1.14. You can add this line on top of your template:

## @param plain:true

There will be no HTML or other markup produced. Only the content rendered from your template.

Let me know if it works!

Regards, Felix [Scandio]

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published 10 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

91 views 2 4
Read article

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