1. Trevor Campbell
  2. Report Editor
  3. Monday, December 04 2017, 05:07 AM
  4.  Subscribe via email
I am trying to figure out how to used report controls as part of a mathematical formula. I have uploaded 2 screenshots.
calc_control.jpg is the report so far after it is rendered. And calc_control1.jpg is a screen shot of the report in the designer with a description of the controls I'm trying to use.

I'm trying to figure out how to get the sum of the qty_of_lengths and divid it by the PackQty then add 1 to the result.

ie sum(qty_of_lengths)/PackQty +1

I have tried a few different ways and I can't get it to work.
Attachments (2)
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hi Trevor,
Currently, it is impossible to use the summary (or other control) value in expression

But you can use scripts for this task

1) In the MaterialBase Header pre_place script set the lengths to 0;
report.sum_lengths = 0;

2) In the Page Body (reportbody1) post_place script add the current lengths value to the sum:
report.sum_lengths += report.cursor.columnValue( 'qty_of_lengths' );

3) Add an empty expression field (e.g. expPacks) to the MaterialBase Footer - to output the resulting value

4) In the expPacks pre_place script write your expression
report.controls.expPacks.label = report.sum_lengths / report.cursor.columnValue( 'PackQty' ) + 1;
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 1
Trevor Campbell Accepted Answer
Hi Sergey,

That worked perfectly. :D :D :D

Thanks
Comment
There are no comments made yet.
  1. more than a month ago
  2. Report Editor
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.