Extract year from date attribute

  • Asked
  • Active
  • Viewed 2715 times
0

Dear OF Team,

If it is possible, how do I do that? Would substring(string,start,len) work?

Thanks! Andras

1

Accepted answer

Hi András,
If your date attribute is called "my_date", you can write an expression like this:

my_date/@year

In the same way you can write my_date/@month or my_date/@day.
In general, this type of expression applies to all composite attributes. If you want the survey designer to suggest the possible field names, try to write a "wrong" expression an it will give you a hint like this: possible valid values in /sampling_point/my_date: [year, month, day]
Thanks,
Open Foris Team

Brilliant! Please add this to the IDM Expression Language help. Thanks!

Andras Andras

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.

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.