i need to to add a text calculated field in TestTrack, so the field always add itself and then anoter field. so the field will always contain the previous entry and the new one. how can i do it ?, without the testtrack claiming its a recursive formula
2 Answers
the only way to dit is to do a count of the event (adding data to the field) and than run a for each of the ocurrnces with a concatenate of the data with the string itself (old value). here is the example that works for me :
var TicketCount=Item.Events.count("update ticket");
var ticketsStr ='';
for(ticketIndex = 0;ticketIndex < TicketCount;ticketIndex++)
{
ticketsStr = ticketsStr + Item.Events.at(ticketIndex,"update ticket").fieldValue("Customer Name");
if(ticketIndex < TicketCount-1)
ticketsStr = ticketsStr + ",";
}
result = ticketsStr;

- 11
- 2
You are correct that a TestTrack calculated field cannot reference itself in the formula. Even if it could reference itself, consider the following formula for "update ticket":
Item.fieldValue("update ticket")+Item.fieldValue("Type")
In this scenario, the Type value would always be appended but there would be no check to see if the Type value is already in the list. Every time an item is edited the "update ticket" field value would be recalculated and the Type value would be appended again whether it has changed or not.
The solution proposed by Tal solves this problem by looping through the other fields and re-building the value. Additionally if a Customer Name value is modified or deleted, the field value will be correctly calculated.

- 86
- 4