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

asked 18 hours ago

ybuger's gravatar image

ybuger
211
accept rate: 0%


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

permanent link

answered 14 hours ago

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
5.0k119
accept rate: 19%

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

permanent link

answered 14 hours ago

Stefano%20%28OF%29's gravatar image

Stefano (OF) ♦♦
5.0k119
accept rate: 19%

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

permanent link

answered 13 hours ago

ybuger's gravatar image

ybuger
211
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×79

question asked: 18 hours ago

question was seen: 20 times

last updated: 13 hours ago