# Calculated Field in Record Action Table

**URL:** <https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242>\
**Category:** Module Development\
**Created:** [October 17, 2016, 11:16am UTC](https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242 "2016-10-17T11:16:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mmacerl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmacerl/32/4024_2.png) [@Mmacerl](https://forum.inductiveautomation.com/u/Mmacerl)\
**Post date:** [October 17, 2016, 11:16am UTC](https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242/1 "2016-10-17T11:16:24Z")

</div>

I have a record action table as seen on the picture below. I added status column with overriding getCalculatedFields. The problem I have is that the value of the field is the same for all rows but I would like to put a different values in each row. So far I haven’t figured it out how to get different values for each row. If someone can help me with it.

[attachment=0]Selection\_046.png[/attachment]  
my code:  
class extending RecordActionTable:

```auto
@Override
	protected List<ICalculatedField<LabAgentManagerTableRecord>> getCalculatedFields() {
		List <ICalculatedField<LabAgentManagerTableRecord>> list= new ArrayList<ICalculatedField<LabAgentManagerTableRecord >>();
		String print="something";
		
		Status status= new Status(print);
		list.add(status);
		return list;
	}
```

Status class:

```auto
public class Status implements RecordActionTable.ICalculatedField<LabAgentManagerTableRecord> {
	
	String print;
	
	public Status(String print) {
		this.print= print;
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public Object getFieldvalue(LabAgentManagerTableRecord record) {

		return print;
	}

	@Override
	public String getHeaderKey() {
		return "LabAgentManager.table.satus";
	}
}

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 17, 2016, 2:17pm UTC](https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242/2 "2016-10-17T14:17:53Z")

</div>

The record passed into getFieldValue() is the thing that differentiates one row from another - you would use the information in that settings record to calculate a value for that row.

---

<div class="post-metadata">

**Author:** ![Mmacerl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmacerl/32/4024_2.png) [@Mmacerl](https://forum.inductiveautomation.com/u/Mmacerl)\
**Post date:** [October 18, 2016, 6:36am UTC](https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242/3 "2016-10-18T06:36:37Z")

</div>

Could you please give me more detailed answer because I am new to that and I don’t understand completely your answer. What kind of information and how to do that? Maybe you can give me an example. Thank you very much.

---

<div class="post-metadata">

**Author:** ![Mmacerl](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmacerl/32/4024_2.png) [@Mmacerl](https://forum.inductiveautomation.com/u/Mmacerl)\
**Post date:** [October 18, 2016, 8:43am UTC](https://forum.inductiveautomation.com/t/calculated-field-in-record-action-table/12242/4 "2016-10-18T08:43:35Z")

</div>

I figured it out but I have another problem .  
I would like to change value of a String in persistent records but I get an error that it is read only and I can’t change it. How can I disable read only or is there any other way I can do this? Thank you.

```auto
@Override
	public Object getFieldvalue(LabAgentManagerTableRecord record) {
		record.setStatus("stoped");
		return record.getString(LabAgentManagerTableRecord.Status);
	}
```
