cancel
Showing results for 
Search instead for 
Did you mean: 

FormCalc help needed for table processing

AlexGiguere
Contributor
0 Kudos

Hi guys, I have designed a very simple Adobe print-based form from SAP ERP 6.0 in ABAP.

This is an EHS report, basically this will display the injuries (columns) per bodyparts (bodyrow).

The structure of my internal table looks like this

WORK_AREA (this field will be hidden)

BODYPART

INJURY_01

INJURY_02

INJURY_03

INJURY_04

INJURY_05

INJURY_06

INJURY_07

INJURY_08

INJURY_09

INJURY_10

For each new work area, I need to do a page break. This is simple, I just create a conditionnal page break:

I have 3 questions:

How can I create a total in my footer (sum all injury per workarea, I can't used sum(table1[*].injury_xx

because this will do a sum for the whole table, I need to do this sum only per work_area (individual page)

How can I create a total at the end of each line (sum all injury_xx fields for the current looping line)

How can I display the work area on each page

Here an example:

Page 1

Work Area: Mine

BodyPart Injury_01 Injury_02 Injury_03 Total

Arms 2 0 0 2

Legs 0 0 1 1

Back 1 0 0 1

Total 3 0 1 4

Page 2

Work Area: Concentrator

BodyPart Injury_01 Injury_02 Injury_03 Total

Arms 1 0 0 1

Legs 0 0 2 2

Back 1 0 0 1

Total 2 0 2 4

thanks

Alex

Accepted Solutions (1)

Accepted Solutions (1)

former_member188685
Active Contributor
0 Kudos

have a separate row and corresponding cells you need to write the script.

assume for INJURY_01 below is the code , dont change any code. Only change the name == condition

in the page click on the cell , now select the script , wirte this code in calculate event

This is not formcalc, this is javascript, so choose the Javascript from drop down.

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "INJURY_01") "<--if ypu want it for INJURY_02 change this
 {
total = total + fields.item(i).rawValue;
}
}
this.rawValue = total;

Answers (0)