Extract sub-string like LEFT function of excel

Hello !!!

I'm trying to extract sub-string (e.g, first 4 digits) from a text entry
(Institution_name) to a field such as "Institution_code" using
calculate="substr('/data/Institution_name',0,4)", but this only results
---- /dat , where I expect the first 4 digits of the inserted Institution
name like "LEFT" function of excel.

Please help .... !

Thanks,
M

The single-quotes around the path '/data/institution_name' mean that this
is a literal string value. To access the contents of that field, you
should write:

calculate="substr(/data/institution_name,0,4)"

i.e., no quotes around the path

··· On Mon, Nov 11, 2013 at 11:34 PM, Maeshal wrote:

Hello !!!

I'm trying to extract sub-string (e.g, first 4 digits) from a text entry
(Institution_name) to a field such as "Institution_code" using
calculate="substr('/data/Institution_name',0,4)", but this only results
---- /dat , where I expect the first 4 digits of the inserted Institution
name like "LEFT" function of excel.

Please help .... !

Thanks,
M

--

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/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thank you Mitch,

I tried this way (without quotes around the path i.e.
calculate="substr(/data/Institution_name,0,4)" ) too but it doesn't work.

ODK validator 1.3 says: "java.lang.StringIndexOutOfBoundsException: String
index out of range: 4"
&
"ODK collect v1.3 rev 1029" is unable to parse the form.

Any thing else that I should try? Please, suggest !

Thank you,

M

··· On Tuesday, November 12, 2013 11:45:34 PM UTC+6, Mitch Sundt wrote: > > The single-quotes around the path '/data/institution_name' mean that this > is a literal string value. To access the contents of that field, you > should write: > > calculate="substr(/data/institution_name,0,4)" > > i.e., no quotes around the path > > > On Mon, Nov 11, 2013 at 11:34 PM, Maeshal <tito.f...@gmail.com wrote: > >> Hello !!! >> >> I'm trying to extract sub-string (e.g, first 4 digits) from a text entry >> (Institution_name) to a field such as "Institution_code" using >> calculate="substr('/data/Institution_name',0,4)", but this only results >> ---- /dat , where I expect the first 4 digits of the inserted Institution >> name like "LEFT" function of excel. >> >> >> Please help .... ! >> >> Thanks, >> M >> >> >> -- >> -- >> 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/groups/opt_out. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

Upgrade to the latest ODK Validate and ODK Collect.

There were a number of changes to ODK Validate and javarosa that now
prevent this erroneous error message and allow the form to be validated.

http://code.google.com/p/opendatakit/downloads/list

··· On Tue, Nov 12, 2013 at 9:16 PM, Maeshal wrote:

Thank you Mitch,

I tried this way (without quotes around the path i.e.
calculate="substr(/data/Institution_name,0,4)" ) too but it doesn't work.

ODK validator 1.3 says: "java.lang.StringIndexOutOfBoundsException:
String index out of range: 4"
&
"ODK collect v1.3 rev 1029" is unable to parse the form.

Any thing else that I should try? Please, suggest !

Thank you,

M

On Tuesday, November 12, 2013 11:45:34 PM UTC+6, Mitch Sundt wrote:

The single-quotes around the path '/data/institution_name' mean that this
is a literal string value. To access the contents of that field, you
should write:

calculate="substr(/data/institution_name,0,4)"

i.e., no quotes around the path

On Mon, Nov 11, 2013 at 11:34 PM, Maeshal tito.f...@gmail.com wrote:

Hello !!!

I'm trying to extract sub-string (e.g, first 4 digits) from a text entry
(Institution_name) to a field such as "Institution_code" using
calculate="substr('/data/Institution_name',0,4)", but this only results
---- /dat , where I expect the first 4 digits of the inserted Institution
name like "LEFT" function of excel.

Please help .... !

Thanks,
M

--

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/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

--

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/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thank you again Mitch ! It works......!!