I apologize in advance for the inane question, but I have been unable to figure this out on my own. I know it has to be something simple, but I am stuck. Any help would be greatly appreciated.
We have a space called "advancedfixtures". If I create a blank page and insert the following Wiki markup in it, the results are correctly displayed as a table:
{sql:datasource=Vipre}select * from kaseya_combined where groupname like '%advancedfixtures%' {sql}
However, if I try to move this code to a macro and insert the macro in a Wiki page, I get nothing back:
## @noparams {sql:datasource=Vipre} select * from kaseya_combined where groupname like '%advancedfixtures%' {sql}
Ideally, I would like to create a generic macro that can be used in all spaces, where the spacekey gets inserted into the SQL query:
## @noparams #set($spacekey= $paramspacekey) ## Check for valid space key, otherwise use current #if (!$spacekey) #set ($spacekey=$space.key) #end {sql:datasource=Vipre} select * from kaseya_combined where groupname like '%$spacekey%' {sql}
Thanks in advance,
Jim Lancaster
Dallas, TX
In defining your user macro, choose
If you have this, then put showSql=true in the macro to see the sql that is actually being used for the query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thought a screen shot of the user macro definition might be helpful:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No change. The wiki markup works, the macro doesn't. In the first screenshot below, note that the macro (JDL SQL Test) is inserted above the Wiki markup. In the next screenshot, you can see the macro gets interpretted as a text string, and the Wiki markup generates the correct table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nothing changed. To my untrained eye, it appears that the macro code that does not begin with '#' is being interpreted or converted to text. Could the problem be related to calling the sql macro from within my 'jdl-sql-test' macro?
Here is the current macro code:
## @noparams #set($spacekey= $paramspacekey) ## Check for valid space key, otherwise use current #if (!$spacekey) #set ($spacekey=$space.key) #end {sql:datasource=Vipre|output=wiki|showSql=true} select * from kaseya_combined where groupName like '%advancedfixtures%' {sql}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The key is in your macro definition use: Output format: wiki markup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Am I using the wrong syntax for output format? I have "output=wiki" in both the screenshot above and the code example.
Jim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am talking about your user macro definition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How should I modify the 9 lines of macro code above? I can't find anything in the documentation--not even some example code.
Can you point me to something/anything where I could at least see a list of the possible commands and their use? I feel like I'm banging my head on a wall. And I hate bothering people with stupid questions I could answer for myself if I had access to documentation and/or example code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A-ha, I think I've found a possible reason for our inability to communicate. The link below contains a discussion about a similar issue. In version 3.5, there is a drop down that allows you to specify the output format: HTML or Wiki. This drop down does not appear in version 4.2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, so that is why we are having trouble communicating. Yes, that is exactly what I was talking about. For 4.x, Atlassian seems to have removed that capability for new macros, although it is still there for existing macros. I have no idea why it was removed. I could not find documentation (https://confluence.atlassian.com/display/DOC/Writing+User+Macros) on how to accomplish the same. You probably need to render it. I would suggest asking Atlassian to respond to this question (use poke Atlassian).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does the macro work if you take out the "like" clause? In other words, can we rule out the '%xxx%' syntax as the source of the issue?
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.