---
title: "Subtracting a string in Arena"
url: "https://openforis.support/questions/4288/subtracting-a-string-in-arena"
tags: ["arena"]
status: "answered"
score: 0
answer_count: 3
asked: "2025-06-18T19:26:21"
last_activity: "2025-06-19T00:02:41"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Subtracting a string in Arena

Asked by ybuger on 2025-06-18

Hi,

I am having trouble defining an attribute that converts to number the first 2 characters (which are numbers) of a string in another attribute. I tried to imitate the OF manual aString.substr(0, 4) example: Number(row.row_details.substr(0, 2)) but I receive the error "Attribute or entity "substr" not found". I also tried Number(row.row_details.substring(0, 2)) as the JavaScript demo link the manual recommended indicated that substr has been depreciated but no luck there.
How would you advise I move forward?

Thank you!
Tamar


## Answer (score 0, by Stefano (OF) on 2025-06-18)

Link: https://openforis.support/questions/4288/subtracting-a-string-in-arena/4289

Dear Tamar,  
The expression you are writing seems correct (both substr or substring should work), but we will contact you to your private email to better understand this issue and to check together with you how the expression has been defined in your survey.  
Many thanks,  
Open Foris Team


## Answer (score 0, by Stefano (OF) on 2025-06-18)

Link: https://openforis.support/questions/4288/subtracting-a-string-in-arena/4290

Dear Tamar,  
Looking at your survey, it seems like the problem you are having could be related to the use of a code attribute.  
Try to write something like this (in case row_details is a code attribute and not a text attribute):   

`Number(String(row_details).substr(0, 2))`   

Also please avoid to use the name of the parent entity if it's the same of the attribute where you are typing the expression.  
Let us know, many thanks,  
Open Foris Team


## Answer (score 0, by ybuger on 2025-06-19)

Link: https://openforis.support/questions/4288/subtracting-a-string-in-arena/4291

Hi Stefano,

Thank you so much for getting back to me quickly. You are correct, the problem was referencing a code attribute, which I assumed was a string as I defined it as text. Once I implemented your correction everything is running smoothly. 

Thank you!

Tamar
