PocketQuery: How to disable auto load even when "Load macro dynamically" and "Use change params template" options are un-checked

I have incorporated "Change Params Template" as part of my Custom Template hence i have only checked "Enable dynamic parameters" in Macro Definition on the page. I don't want PQ to execute query on page load as it is a complex one and takes time. How can i "Disable Auto Load" from the Custom Template i have made?

3 answers

Thanks for the feedback, Pranjal. DynamicLoad and ChangeParams are currently required unfortunately. It's on the roadmap to enhance this feature. I think you could find a workaround with ChangeParams unchecked (I can help you with that if you want). But DynamicLoad is definitely required currently.

That would be great Felix. Currently i have given some special characters in the Default value of parameters for which i know there are no related records in the DB. When the page loads, it loads with the form but with a message as "Query was executed successfully, the result set was empty". This confuses users as they don't know what this message is and what query it is talking about, i need to explain them (As many are from non technical background).

 

BTW, i did try the method of pasting the JQuery code (Custom HTML at the end of the page) mentioned on other ticket but it did not work.

Felix,

I am waiting for your help on this.

Hi Pranjal,

Thanks for remembering! How about checking DynamicLoad AND ChangeParams and simply hiding the ChangeParams form with CSS in the template?

<style>
.pq-dynamic-parameter-form { display: none; }
</style>

Regards, Felix

Felix, it did not work, let me tel you why.

I also have a custom form with the same class i.e. class="aui pq-dynamic-parameter-form". So i changed this class name, enabled "Change Params Template", "Dynamic Load" and Disabled "Auto Load". I added the script you gave me in my custom template. The moment i did this, my form got masked by the default form that comes when you enable "Change Params Template".

 

Ideally, the default should be hidden and the one i made should be visible.

my form got masked by the default form that comes when you enable "Change Params Template"

Sorry, I'm a little lost. You hide the default form .pq-dynamic-parameter-form with CSS. You give your form a different class. I would think the default form would now be hidden and your form would be visible?

Even if i change the class name of my custom form, my custom form is getting hidden and the default one starts appearing.

 

One more observation, when "Disable AutoLoad" is set to true and no value in the Default Value field, the text fields are not appearing on the page and only Change button is appearing.

 

We can have a quick GoTo meeting session if you are available for 5 mins. I can send you an invite. What do you say?

Felix,

Please do let me know your suggestions here.

Hi Pranja, I will reproduce this on my local system during the next days. I'll let you know.

Hi Pranjal,

I created a new beta release for PocketQuery 2.1.1. You can find it here. With this version, the only requirement for "disable autoload" will be "dynamic load". So you should be able to use it properly with your own form. Besides that, the issue that fields in the form won't appear if you didn't enter anything should be fixed as well.

Please let check it out and provide me some feedback as always smile. Thanks for your support!

Regards, Felix (Scandio)

Felix,

Here are the observations:

  • Preview does not load with "Disable autoload" set to true.
  • Since i have my custom form in template, i have disabled (unchecked) "Use change params template". With this unchecked, my custom form does not appear.
  • When i check (enable) "Use change params template", I see default form of PQ despite my form there in the template.
  • When i search using the default form, the results get loaded along with my custom form.

It seems that template associated with a query is getting loaded/executed only when result is being displayed.

Have a look at the Snapshot below:

image2016-6-28 17:2:14.png

Felix,

I guess the template always loads at the time of results. Since i have my default values defined as junk (in prod instance), the query returns empty result on page load along with a message and my form along with this. This gives an impression that form is loading on the page load but actually that's not the case.

This scenario changes when you check "disable auto load" and uncheck "Show change params template", you actually don't see anything.

Also, if you are just executing standalone query like "select * from emp;" and "disable auto load", you'll see a blank page which is obvious and users will not even get to know that there is a macro there. Ideally for queries without parameters, there should be some way to execute queries with Auto Load disabled.

OR, "Disable auto load" should be kept for queries only with parameters not with others.

I may not have explained the case in proper order but hope you get the gist.

The only reason i defined my custom form was:

  • To have field names in bold.
  • Hide default values.
  • Change the name of button to Search.

 

I see what you are saying with "disable autoload". Maybe you can try it with simple CSS and JS and use the default change params template:

<style>
.pq-dynamic-parameter-form label { font-weight: bold; }
</style>
$PocketQuery.template("default")
<script>
jQuery('.pq-change-button').text('My Button');
jQuery('.pq-dynamic-parameter-form input').val('');
</script>

However, there will be a delay until this is really done...

Another workaround would be to use two queries. One is only for the form and is kind of a dummy query like "SELECT 1". In the template with the form, you can use JS to render another query that actually produces the result. I put up an example for someone else one day that you can find here: 

Maybe this helps.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 in Confluence

What are your project planning tips?

Hello Community,  Jessica here from the Confluence product marketing team! Today I wanted to get your takes on project planning –– what works, what doesn’t, how do you know if you’re doing it r...

259 views 1 4
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