1

I came across How to calculate custom fields in ArcGIS Reports? and it's very similar to what I'm trying to accomplish. I have two fields that are sums and would like to divide them in order to get a percentage.

Based on the response, I'm assuming a C# expression is needed, but I haven't a clue how to write a C# expression. I was hoping someone could point me in the right direction, or provide a general C# expression example using sum and/or divide...?

Based on the screenshot below, my expression would be something like: sum(Field1) / sum(Field2) --- green / red

enter image description here

0

1 Answer 1

1

As per doc

There are two ways to create calculated fields in the Report Designer. The first method is to add a text box to the report and enter an expression into the text box that will get executed when the report is generated. The steps to this method are outlined below, including expression examples. The second method is to add an unbound Calculated field to the report. You can only do this from the Report Section tree. Right-click on the Calculated node of the tree and choose Add. This will create an unbound field that can be used in the report. The expression of the unbound field should be set in the Formula property of the field. Once the Formula is set, drag the field on to the section in the report where you want to use it.

Unbound fields allow you to use other unbound fields in the Formula. As a result, you can create Summary fields that use unbound fields to generate dynamic content in the report.

and at the end it says:

You will not be able to use unbound calculated fields to calculate a summary statistic that uses other summary statistics in the formula.

So the short answer is, It is not possible to do what you need. and it is related to the poor design of ArcGIS reporter generator!

Although there is not any Report tool to achieve this, there a workaround. Preprocess your data and add a new field (percents) to your table; use field calculator to calculate percents; then add a summary field(sum of percents / records count) in report designer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.