I've been looking around documentation for PocketQuery to find information on dynamic parameters using REST API queries but I can only seem to find examples for SQL queries. What I would like to do is enable dynamic parameters on my REST query so I can search through a list of names in a contact database without having to load up the entire database and just using a Table Filter macro. I see that in order to add in dynamic parameters you have to add in pq_ before the variable, but I am trying to filter on one of the columns that I am already pulling with my converter.
Can anyone help out?
Hi @Ryan Davis
dynamic parameters are a macro option and don't have much to do with your query itself. By enabling dynamic parameters you're telling PocketQuery to look for parameters in the URL of your page to use in your query. So for example in this URL:
https://your-confluence.com/your-page?pq_year=2019
PocketQuery will pick up the year parameter and set it to 2019 if one of your queries in that page has a year parameter. Also see here for a further explanation.
I think what you are actually looking for are probably query parameters. You can define a query parameter in you query by using the colon syntax (e.g.: :myparam). This works both for SQL:
SELECT *
FROM customers
WHERE name = :name
and REST:
/customers/:name
By the way: You can also use so called wildcards. For example, if you want the name of the current page filled in automatically you could do:
/pages/:@page
You can find all available wildcards here. If you need specific help designing your query you can always raise a ticket at our HelpDesk for PocketQuery where we can help you with more details.
Hope that helps! :)
Best regards,
Sven
We're just testing your pocket query addon.
Is it possible to pass a parameter directly to a SQL statement without filling the parameter field in the Pocket Query macro.
So far I've only managed to do it this way
In the query
Select * from Bla where user = :userFullName
userFullName = String
and must then set the parameter
userFullName = @userFullName
so that the logged in user can see his data.
In your example above
/pages/:@page
seems as if you could pass the parameters directly through or only refers to the REST call because the SQL statement doesn't work like this
Select * from Bla where user = :@userFullName
Georg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Georg,
Yes, this is exactly what wildcards in Query statements are for! See them in the documentation: https://help.scandio.de/documentation/display/PQDOC/Queries#Queries-UsingParametersinQueries
:@userFullName may not work because wildcards might be case sensitive if I remember correctly. Have you also tried :@userfullname?
Cheers,
Sven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sweet! Should you encounter more questions don't hesitate to raise a ticket at our ServiceDesk. There you can also send us your concrete Queries, Templates and Converters privately. :)
Cheers,
Sven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.