IF THEN ELSE Conditional Statements

  • 3
  • Question
  • Updated 2 years ago
How is the best way to use Scaffolding and Reporting when we need IF THEN ELSE Conditional Statements?

Please provide examples for different data types:
* text (wiki or richtext values)
* date
* numbers
* graphics
* users
* groups
* links


Our environment is Confluence Data Center 5.8.18 with Scaffolding v8.1.4 and Reporting v6.1.4

I do see that other users have asked similar questions from time to time on this forum, but it apprears the method to achieve a result are often bringing back empty values. 

Perhaps this request should actually be an 'enhancement request' to get ServiceRocket to provide conditional statements for coding using the Reporting and Scaffolding macros.  I am looking forward to your recommendations.
Photo of Stephen Gramm

Stephen Gramm

  • 154 Posts
  • 6 Reply Likes

Posted 2 years ago

  • 3
Photo of Ethan Foulkes

Ethan Foulkes

  • 310 Posts
  • 41 Reply Likes
Usually you can do this by putting 2 report blocks inside of a report column. Each one has a text filter pointing at the (If Then) field in question.
Photo of Stephen Gramm

Stephen Gramm

  • 154 Posts
  • 6 Reply Likes
So how would this work in the case we wanted to conditionally change items in a drop down list option dialog?  Please provide examples if possible.
Photo of Ethan Foulkes

Ethan Foulkes

  • 310 Posts
  • 41 Reply Likes
You would nest 2 report blocks inside of your list-data. Each one would point at your target data source and have a text-filter based on your if/then source. Exact configuration will depend on where your if/then field exists and where your source data exists. Ideally they are on the same page and it should be pretty easy. If not, it can still be done but will take a little more work.

Trying to give you some general guidance in theory vs. actual examples since syntax is always slightly different for each use case...
Photo of Stephen Gramm

Stephen Gramm

  • 154 Posts
  • 6 Reply Likes
So far no one has come up with a good way to perform the operations like the classic IF THEN ELSE comparison used in all programming.  What has been provided does work to use the text-filter macro for a report-block macro.

We would like to get ServiceRocket involved on this ticket and believe they should add the functionality that makes conditional operators a viable part of the ServiceRocket library.

Please let me know if you agree or have a more usable alternative, but here is one example using the text-filter from one member of our user community.

(Edited)
Photo of Alexander Duschau-Wicke

Alexander Duschau-Wicke

  • 7 Posts
  • 1 Reply Like
Does this still work in the most recent versions of Reporting? For me, nothing works, unless I put the Text Filter inside the Local Reporter, but then I can only have two alternatives.
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
Us too
Photo of Mervyn Toh

Mervyn Toh, Alum

  • 117 Posts
  • 7 Reply Likes
Hi all,

The above report structure has been deprecated. That said, we've come up with the latest method report structure for this on our ServiceRocket Documentation.

Thank you.
Photo of Alexander Duschau-Wicke

Alexander Duschau-Wicke

  • 7 Posts
  • 1 Reply Like
Yes, that helped, thanks Mervyn!
Photo of Ethan Foulkes

Ethan Foulkes

  • 310 Posts
  • 41 Reply Likes
Hi Stephen,

Should have thought of this earlier. A cleaner If Then Else methodology would be to use the report-empty macro and then nest your next report-body inside of that. You can continue nesting them and it will continue looping through the Ifs until it finds an answer.

Report-empty just sits below report-body
Photo of Stephen Gramm

Stephen Gramm

  • 154 Posts
  • 6 Reply Likes
I have used the {report empty} method, but is is not exactly what I need.  It would really be great if there were conditional operations available in the ServiceRocket plugin library.

How can we get the tools updated or created by ServiceRocket?
(Edited)
Photo of Mervyn Toh

Mervyn Toh, Alum

  • 117 Posts
  • 7 Reply Likes
Hi Stephen,

I believe we have come up with the answer for this issue on our ServiceRocket Documentation.

Thank you.
Photo of Stephen Gramm

Stephen Gramm

  • 154 Posts
  • 6 Reply Likes
Thanks for responding but the documentation provided for the IF THEN ELSE does not work as detailed on this page.

The users would need to nest each report block within each other report blocks, until all conditional statements are exhausted, and then have one report empty to make this work as expected.