Subtracting a string in Arena

  • Asked
  • Active
  • Viewed 1929 times
0

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

0

Accepted answer

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

0

Accepted answer

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

0

Accepted answer

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

Your answer

Markdown text. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+E code, Ctrl+Shift+V paste as plain text. Tab indents list items and code; press Escape, then Tab, to leave the text box.

Insert an image

Say what the image shows, for people who can't see it.

Tip: type a few words from the error message, or put a tag in [brackets] to look only there.

Menu

Keyboard shortcuts

Anywhere

?
Show this list
/
Search
g h
Go to the home page
g q
Go to the questions
g t
Go to the tags
g u
Go to the users
a
Ask a question

Lists of questions

j k
Next or previous question
Enter
Open the question

Question pages

j k
Next or previous post

Shortcuts never apply while you type in a text field. Members can turn them off in their preferences.