Confluence RUN / CLI / SQL: Pass generated variables to each other
Asked by Daniela Scheiwe:

Hi,

It's complicated to explain, to put it short, I want to:

Get user generated values with RUN, get a result from a DB query with these, use that result and the other values with CLI. Problem is, I don't know how to "store" the result of the query for further usage in CLI.

Long version:

I'm currently building a user input mask for creating new projects using the run \& cli-plugins in combination with the sql plugin.

Setup:

Run-Form asks for customer key and some other data, upon "run" an sql query gets the customer name from another database. Thats works.

Then I'm using CLI to add the space, space key is the customer key, space title should be the customer name that is fetched from the external database, but I can't get that working.

If I directly enter the sql query macro as a value for the space title in the CLI command, the spaces title will be {sql-query}myquery{sql-query}.

When I execute the query before the CLI-macro I get the value, but I have no idea how to get that result of my sql-query passed onto the cli macro.

I also tried nested runs with a replace-value = my sql query, but that totally messes up the macro.

Any help is appreciated!


Answers:
author: Bob Swift (personal)
body: I would usually go to a little scripting for complex cases, you can gets some hints from [How to generate choice values using SQL](https://bobswift.atlassian.net/wiki/display/RUN/How+to+generate+choice+values+using+SQL) . In some cases you can get away with replace and render type logic to like [How to generate choice values using replace and render](https://bobswift.atlassian.net/wiki/display/RUN/How+to+generate+choice+values+using+replace+and+render) . If you need more help, I would need more time to look at all the details - open a [support issue](https://bobswift.atlassian.net/browse/RUN).

comments: author: Daniela Scheiwe
body: Thanks Bob, I will give that a try. If I dont get this working, is it possible to change the space title with cli? I could create the space and rename it later then. Haven't found any option to update a space...


author: Daniela Scheiwe
body: Just gave it a try (never used replace and render before), it worked instantly. Thanks a lot!!


author: Bob Swift (personal)
body: There is not a remote API to update the space title or description :(. The CLI would have to use some other techniques to provide that. Open an issue if it is important.


author: Daniela Scheiwe
body: Thanks for your feedback. As I managed to set the space title upon creation now I don't need to rename. But one last question - is it possible to define the space homepage with CLI 2.5? I first create the space, then copy some pages and then I want to set one of these pages as the space homepage.


author: Bob Swift (personal)
body: I think that came in a later release at least that is what the doc archive [2.5.0](https://bobswift.atlassian.net/wiki/display/CSOAP/2.5.0) indicates.


author: Daniela Scheiwe
body: Might be helpful for others:

Solved by saving my new homepage with the same title as the old home page with replace paramater :)

Bob, in general: A big thanks for your great plugins!


Tags: bob-swift

cli

run

sql