It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

scaffolding - how to modify a variable's value

I have a case where I need to modify the value of a variable after it is initially set.

The reporting macro is in use to set the variable initially, but there are cases where I would need to further scrub down the value to ensure it is useful.

The following is the current code that initially sets the value of the variable 'app_APPNAME_include'



{collection-filter:@self}{text-filter:data:appname > reference:value|include=APPNAME}{collection-filter}




Once it has been set, the app_APPNAME_include variable will have a value like one of the following...

* true

* false

* truetrue

It is in the case of 'truetrue' where I would want to scrub the value to make it a single occurance of the string 'true' rather than a repeated string.

Does this value modification need to occur within the report block - or as a post processing of the app_APPNAME_include variable that gets set.

I'm anticipating needing to do some type of regular expression match/replace on the value but am not sure how to go about doing so.

Any help is appreciated.

5 answers

1 accepted

0 votes
Answer accepted

This seems to have worked out for me.

{text-filter:data:appname  > reference:value|include=APPNAME}

I think I found a way to make this work...if there's a better or more efficient way to do this, please follow up here and let me know...

Wiki code follows:

* Before: {set-data:myBoolean}falsefalsefalse{set-data}
* After: {report-block}

Actually, that's not working out 100% for me.

When I define the myBoolean variable to falsefalsefalse directly, I seem to get valid results from the report block and text filter.

* Before: {set-data:myBoolean}falsefalsefalse{set-data}

* After: {report-block}{local-reporter:data:myBoolean}{text-filter:include=.*true.*}{local-reporter}{report-body:trim=true}true{report-body}{report-empty}false{report-empty}{report-block}

However, when I tried moving this to work with a scaffold variable -- app_APPNAME_include -- which has it's value previously set to the result of a report, it does not work for me.

* Before: {get-data:app_APPNAME_include}

* After: {report-block}{local-reporter:data:app_APPNAME_include}{text-filter:include=.*true.*}{local-reporter}{report-body:trim=true}true{report-body}{report-empty}false{report-empty}{report-block}

The two code sample above render as below...needless to say, it is not desirable to have "false" getting translated to "true"

  • Before: falsefalsefalse
  • After: false
  • Before: false
  • After: true

I think I may have found a workable solution by restricting the report results to only one matching row.

* {set-data:app_APPNAME_include}{report-block:maxResults=1}



{text-filter:data:appname > reference:value|include=APPNAME}





Since the report would already be returning only rows that were set to include=true (the report variable:app_included would only contain rows that matched true) I can be fairly certain that any rows of data within have a value of true.

At the moment, this seems to be giving me what I want, a final value of just 'true' or 'false' in the app_APPNAME_include variable.

Will report back after a bit of pressure testing to see if this really does solve this issue.

Of course, if there's another way to do it, I'm open to hear it :-)

Hi Jim,

Just FYI, what is actually happening with {set-data} is that it stores the wiki markup, not the actual 'true/false' (or 'truetrue', or whatever) result. As such, it gets executed every time you view the value on the page, and if you want to process it, you have to render it, otherwise you're processing '{report-block....}', rather than 'true/false'. Hope that makes sense...

It would help if I knew two things:

a) What does 'variable:app_included' contains - how is it set?

b) What are you trying to use the 'app_APPNAME_include' value for? Is it for further processing on the same page? Is it for use on other pages doing a report? Does the value need to survive beyond viewing the current page?

That said, I'll take a guess at providing something that might get you on the right track. Something like this:

{report-variable:app_APPNAME_include|value=%variable:app_APPNAME_items > collection:is empty > boolean:negate%}

This should give you a 'true' or 'false' value in 'variable:app_APPNAME_include'. If you need to store this as a 'Scaffolding' data value via {set-data}, you probably need to use {replace-and-render}, since injection causes issues, and you can't just use the {report-info} here, due to what I said earlier about how {set-data} stores its values. That would look like this:


If you don't actually need it to be stored in Scaffolding, then skip that stage. Your mileage may vary...

Hope that helps!


David Peterson

Thanks for the explanation of the order of ops with {set-data} macro. I was wondering if there was something like that going on under the hood. I previously used twiki for a few years and ran into similar ordering issues there as well).

As for HOW some of the vars are set:

a) variable:app_included is previously set using {report-variable} and


b) all variables set are intended for processing on the same page

some are used directly within a {report-table} to display the collected

info and again used to set {replace-item} variables for later use in the


As I previously commented, I found a workable solution by setting the maxResults=1 attrib to the report block.

It looks like setting {report-variable:name} to the report results may be more efficient way of setting vars than my current model of a {report-block} inside a {set-data}. I'll look into how I might be able to do things that way instead - as it might save me many lines of wiki syntax down the road.

Can you point me to a good online reference/documentation on the scaffolding macros and injection?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

327 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you