report-eval default value

  • 1
  • Problem
  • Updated 3 years ago
I am using the report-evaluation macro, which is great, by the way.  However, the default value doesn't work.  Instead, the results are -16875 until all parameters in the evaluation have values.
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes

Posted 3 years ago

  • 1
Photo of andrew.vaningen

andrew.vaningen

  • 587 Posts
  • 59 Reply Likes
I have a problem with report-eval too since the newest upgrade yesterday.
Photo of andrew.vaningen

andrew.vaningen

  • 587 Posts
  • 59 Reply Likes
I have rewritten the whole code. Now it works
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
Does the default value work for you?  It has never worked for me in any version of scaffolding.
Photo of andrew.vaningen

andrew.vaningen

  • 587 Posts
  • 59 Reply Likes
I believe it has worked. But can't guarantee.
Photo of Kathryn Moye

Kathryn Moye

  • 223 Posts
  • 12 Reply Likes
A co-worker of mine, understanding the order of execution better than I, found out why this works the way it does.  I'm not sure why Service Rocket didn't respond here.  It wasn't that the default value wasn't working, instead it was seeing values for everything so it didin't think it needed to use the default.  I was injecting values into the report-eval.  The page injected values for each parameter (and a 0 for those that didn't exist) then report-eval ran.  Report-eval can't tell that the 0 it was given was because the value didn't exist.  Therefore you have to use the conditional operator ?: to return the zero instead.  In my case, it was always the first parameter in the subtraction expression that would not exist at a point in our process.  So...if the answer is positive, return the answer and if the answer is negative, give me back a zero instead.

Use this as the formula in the report-eval
<code>(%data:X1% - %data:X2% >=0) ? (%data:X1% - %data:X2%) : 0</code>