Split string

Dear ODK community,

In ODK collect I need to take an answer and store it in two different
variables. The variables shall be calculated by spliting the answer at a
space " " character. Is there an equivalent of stringsplit or stripstring
to break a form answer as such?

Hopefully someone can help me out!

https://opendatakit.org/help/form-design/binding/ has a list of the
commands you can try.

There is no substring, but because XForms stores selects as a space
separated list, you can do something like this:
selected-at(/data/my_answer, 1) to get the first element (or second,
don't remember) of my_answer.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Thu, Jul 23, 2015 at 4:39 PM, jpardila bluejp@gmail.com wrote:

Dear ODK community,

In ODK collect I need to take an answer and store it in two different
variables. The variables shall be calculated by spliting the answer at a
space " " character. Is there an equivalent of stringsplit or stripstring to
break a form answer as such?

Hopefully someone can help me out!

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Excellent Yaw! You are a life saver! I was not aware of the "at" indexing.

cheers! JP

··· Le jeudi 23 juillet 2015 18:32:36 UTC-5, Yaw Anokwa a écrit : > > https://opendatakit.org/help/form-design/binding/ has a list of the > commands you can try. > > There is no substring, but because XForms stores selects as a space > separated list, you can do something like this: > selected-at(/data/my_answer, 1) to get the first element (or second, > don't remember) of my_answer. > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > > On Thu, Jul 23, 2015 at 4:39 PM, jpardila <blu...@gmail.com > wrote: > > Dear ODK community, > > > > In ODK collect I need to take an answer and store it in two different > > variables. The variables shall be calculated by spliting the answer at a > > space " " character. Is there an equivalent of stringsplit or > stripstring to > > break a form answer as such? > > > > Hopefully someone can help me out! > > > > -- > > -- > > Post: opend...@googlegroups.com > > Unsubscribe: opendatakit...@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "ODK Community" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to opendatakit...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. >