Using the Confluence macro metadata 2, I would like to set a handful of pieces of metadata for a page (project number, JIRA key for example) and have those passed to variables in (Bob Swift) SQL queries
In my trial I set a hidden metadata value with the key "projectcode", In wiki markup:
{metadata:projectcode|hidden=true}[A1234]{metadata}
and using metadata-from as follows:
{metadata-from:projectcode}
I return "A1234"
In my sql statement
select actual from gates where project_code = 'A1234' and gate = 'S4'
which is contained within the SQL macro I would like to replace (in some way) the currently hardcoded 'A1234' with the SOME variable that is populated by the metadata contained within projectcode.
This will allow me to parameterize the pages we use in this fashion as a template; add a few pieces of metadata to the page and presto it works for whatever project I am pointing it at.
One way would be use the Run macro (or Run-now macro) around the SQL macro and the meta-data substitution capability. The reporting macros can do the same kind of thing if you have that.
Thanks Bob. That works great and you actually ended up also answering a question I was GOING to have. While you answered that one in that way I continued to RTFM and realized that I needed to check the "Evaluate wiki markup" option in the macro and then the statement select actual from gates where project_code = '{metadata-from:projectcode}' also worked. Thanks for your speedy response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.