# Arithmetic operations - shapefile attribute tables

**URL:** <https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895>\
**Category:** MapWinGIS\
**Created:** [January 31, 2021, 5:26pm UTC](https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895 "2021-01-31T17:26:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murilo](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/murilo/32/485_2.png) [@Murilo](https://mapwindow.discourse.group/u/Murilo)\
**Post date:** [January 31, 2021, 5:26pm UTC](https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895/1 "2021-01-31T17:26:07Z")

</div>

Dear all,

I’m new to programming with MapWinGis. I looked in the documentation, but I found it difficult. Could someone show me a code where arithmetic operations would take place between fields in the shapefile attribute table. For example: multiplication between two fields in the attribute table and save the result in another field.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [February 4, 2021, 8:34am UTC](https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895/2 "2021-02-04T08:34:51Z")

</div>

Have a look at the Table class and especially at the [Calculate()](https://www.mapwindow.org/documentation/mapwingis4.9/class_table.html#a75d190cd8adb930122b14b141a093f42) method.

First, you add a new field, next you do the calculation and save the result in that new field.

In MapWindow v5 (the C# GUI for MapWinGIS) you can have a look at how it is implemented:

 ![image](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/df1b7d4725b86a49eca8c20e49068a7695c02706.png)

The string, in this example `[STATE_NAME] + [AREA] / 100` is the expression.

Here’s an example of how to get a field and alter its data: [MapWinGIS: CalculateArea.cs](https://www.mapwindow.org/documentation/mapwingis4.9/_calculate_area_8cs-example.html)

I see we don’t yet have an example of sf.Table.Calculate().  
Perhaps you can share your results and I’ll try to add it as an example.

---

<div class="post-metadata">

**Author:** ![Murilo](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/murilo/32/485_2.png) [@Murilo](https://mapwindow.discourse.group/u/Murilo)\
**Post date:** [February 5, 2021, 3:02pm UTC](https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895/3 "2021-02-05T15:02:50Z")

</div>

Hello @pmeems

Thanks for your answer.

I had already searched for the code in those indications, but I haven’t had a positive result yet. I will continue to try to implement Sf.Table.Calculate (), because I need it for my PhD thesis.

If anyone can help me thank you.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 2:45pm UTC](https://mapwindow.discourse.group/t/arithmetic-operations-shapefile-attribute-tables/895/4 "2022-01-05T14:45:39Z")

</div>

Sorry for the very late reply.

Do you still have questions about `sf.Table.Calculate()`?
